How to configure PHP to run the same version on the web server as in a background process

那年仲夏 提交于 2019-12-13 06:56:43

问题


From the command line:

php --info
//⇒ PHP Version => 5.5.18

From the command line within a background process:

exec('php --info>>logs/phpVersion.txt');
//⇒ PHP Version => 5.5.14

I want the background process to run version 5.5.18 (or the same version as the web server). Where is that configured?


回答1:


You must reinstall 5.5.18 to replace 5.5.14. It's not a configuration file, there are two instances of PHP.

If you specify on OS, I will update this answer with further instruction. (Or just Google it)




回答2:


A simple solution for getting the MAMP version of PHP to run a background process instead of your system's version of php, is to simply call your MAMP version, right there in the exec() function. So for me, that call looks something like this:

exec('/Applications/MAMP/bin/php/php5.5.18/bin/php myscript.php &');



来源:https://stackoverflow.com/questions/27250198/how-to-configure-php-to-run-the-same-version-on-the-web-server-as-in-a-backgroun

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!