php.ini - command line PHP and WAMP server access different files

余生颓废 提交于 2019-11-27 06:32:57

问题


I don't know if this is default behavior or not, but it seems weird to me.

I installed WAMP server v2.2e from scratch, with PHP 5.4.3, on a windows 7 machine. I get these minor bugs that i don't really care about (when I activate an extension I sometimes need to exit WAMP and start it again to see the changes),

but that's not why I'm here.

When I click on the WAMP icon -> PHP -> php.ini, the file I open is the one in the apache directory (<WAMP dir>\apache\apache2.4.2\bin\php.ini)

The output from the windows cmd command php -i | find /i "Configuration File" outputs <WAMP dir>bin\php\php5.4.3\php.ini

Is this desired behavior?


What I'm actually trying to do is install phpdoc, and the output I get after opening (with my browser, not with the command line PHP) localhost/phpDocumentor/installer.php has these lines:

...
...
Problem 2
- Installation request for phpdocumentor/template-checkstyle 1.0.1 -> 
satisfiable by phpdocumentor/template-checkstyle 1.0.1.
- phpdocumentor/template-checkstyle 1.0.1 requires ext-xsl * -> 
the requested PHP extension xsl is missing from your system.
Problem 3
- Installation request for phpdocumentor/template-new-black 1.0.4 -> 
satisfiable by phpdocumentor/template-new-black 1.0.4.
- phpdocumentor/template-new-black 1.0.4 requires ext-xsl * -> 
the requested PHP extension xsl is missing from your system.
Problem 4
...
...

... you get the idea.

The php.ini file WAMP uses has:

extension=php_xsl.dll

And the php.ini the command-line php uses has:

;extension=php_xsl.dll

I could just uncomment the extension in the other .ini file but that won't solve the problem.


Any ideas?


回答1:


Everything you have mentioned is expected behavior. Apache has it's own php.ini version it uses, and require an Apache restart to make any changes effective.

CLI will also have it's own php.ini.




回答2:


I just got mine fixed by following steps:

  1. Downloaded extensions according to my php version(7.2)
  2. Checked the PHP Extension Build API20170718,TS, VC15( so picked the file with ts in name)
  3. Added the files in C:\wamp64\bin\php\php7.2.10\ext
  4. Added extensions in C:\wamp64\bin\php\php7.2.10\php.ini
  5. Added extensions in loaded appache ini file too:Loaded Configuration File C:\wamp64\bin\apache\apache2.4.35\bin\php.ini
  6. Hit save.
  7. Exit Wammp and run again
  8. Hit php -m in cmd ------------------Boom-----------------------



回答3:


It is common practice to have separate php.ini for cli, cgi ...

As for different environment you might want to use different setups, load different modules.



来源:https://stackoverflow.com/questions/13827884/php-ini-command-line-php-and-wamp-server-access-different-files

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