Dori
Dori

Reputation: 1055

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

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?

Upvotes: 1

Views: 11578

Answers (3)

Muhammad Awais Ullah
Muhammad Awais Ullah

Reputation: 21

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-----------------------

Upvotes: 2

Mike Brant
Mike Brant

Reputation: 71422

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.

Upvotes: 3

E_p
E_p

Reputation: 3144

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.

Upvotes: 0

Related Questions