Zend Server on OS X: Running php-cli in lieu of php

On OS X, Zend Server comes with a PHP binary at /usr/local/zend/bin/php. For running things on the CLI, however, one must go through /user/local/zend/bin/php-cli, which is just a shell script that runs a secondary Zend script to configure some library paths and such before turning around and running the basic /usr/local/zend/bin/php.

What's the best way to get PhpStorm to use the /usr/local/zend/bin/php-cli script as a replacement for PHP when running things in CLI mode (e.g., PHPUnit)? The interpreter setting only lets me point to the directory, not to the specific php binary. Alternatively, is there something else I can do to make PhpStorm use the Zend Server version of PHP without producing various library errors?

3 comments
Comment actions Permalink

Hello, Bob

The interpreter setting only lets me point to the directory, not to the specific php binary.

Correct, but you are the first who complains about that. Feel free to submit a usability problem (http://youtrack.jetbrains.com/issues/WI#newissue=yes) if it bother you, but let's discuss you case before.

Alternatively, is there something else I can do to make PhpStorm use the Zend Server version of PHP without producing various library errors?

Please note that you will meet the same issue if you try to use this binary from command line. I am not sure that this binary is intended to use from command line, but specifying a path to alternative 'php.ini' configuration file (using '-c' option. see http://www.php.net/manual/en/features.commandline.options.php for details) can solve the issue. You can also vote for the feature to support this option directly within the PhpStorm - http://youtrack.jetbrains.com/issue/WI-10454

What's the best way to get PhpStorm to use the /usr/local/zend/bin/php-cli script as a replacement for PHP when running things in CLI mode (e.g., PHPUnit)?

Try to create a symlink (with name 'php') to this binary and put it in some separate folder (for example: /usr/local/zend-php/bin).

Please let me know if my suggestion will help you or not.

Thank you for feedback!

0
Comment actions Permalink

Please note that you will meet the same issue if you try to use this binary from command line. I am not sure that this binary is intended to use from command line, but specifying a path to alternative 'php.ini' configuration file (using '-c' option. see http://www.php.net/manual/en/features.commandline.options.php for details) can solve the issue. You can also vote for the feature to support this option directly within the PhpStorm - http://youtrack.jetbrains.com/issue/WI-10454



Actually, it's intended to be used like this from the command line. Zend has the normal php binary set up for use within Apache, and utilizes libraries provided by that environment. When you try to run it from the command line, you get error messages about those libs not being available, and the functionality that relies on them is broken. So, they also have a php-cli binary that's intended to be used from the command line. It's really just a bash script that imports the necessary libs, sets some environment variables, and then calls the regular zend php binary. As far as I know, these are not things you can do through the php config file; thus, the -c option won't help here.

Try to create a symlink (with name 'php') to this binary and put it in some separate folder (for example: /usr/local/zend-php/bin).


That actually works, and is a great work-around for now.

Thanks.

0
Comment actions Permalink

Bob,

That actually works, and is a great work-around for now.

Please note that we don't consider this is as a workaround now. Feel free to submit a new issue if you want that we support your case in PhpStorm - http://youtrack.jetbrains.com/issues/WI?q=path#newissue=yes

Thanks for feedback!

0

Please sign in to leave a comment.