How to determine which PHP is being used?
For example, if there are /usr/local/bin/php and usr/local/bin/php5, how do I know which one is being used by my PHP scripts?
|
How to determine which PHP is being used? For example, if there are |
|||
|
|
|
If you are using the PHP CLI, then try using theese shell commands (i'm assuming that you are using linux here)
If you are using PHP as an Apache module then phpinfo() will tell you the php version used, and the php config files, NOT the php path. If you have 2 versions of the php executable then this will help you. If they are the same version then it wont really matter which one is who:) If you want to find out the php version, then php -v will print the php version in the CLI and any Zend modules installed. If you want to find out the ini files included then php --ini will display th list of ini files loaded by the php module (this applies for the CLI version). |
|||
|
|
Assuming You are Using through Web Server:
If this doesn't work, it could be because this function is disabled in the php.ini . This is often done for security. If this is the case, you will have a line in your php.ini like:
If this is the case, temporarily change it to
If you are Using php for Shell Scripts:
|
||||
|
|
|
Also from the commandline:
|
|||
|
|
|
|||
|
|
|
If you are talking about your web-scripts that are called by your Apache webserver and PHP is configured as an Apache module then the answer is NONE. The locations you mentionend in your question are command line script interpreters that would be called by shebang notation like
at the top of your php-command line script you can call the interpreters you mentioned separately, since they have different names
would call /usr/local/bin/php and
would call /usr/local/bin/php5 Neither one of those is used if you use PHP via the Apache module. If you use the CGI-Version of php it should show up in the phpinfo(); output. |
|||
|
|
This works even if you don't have shell access. ;-) |
|||
|