2

I use PHP on my Windows host system for composer. After a failed attempt to add parse/php-sdk to a project (since the SDK needs the PHP cURL module to be enabled), I updated the PHP settings. But it didn't solve the problem. Then I checked, whether the php.ini settings are correct:

C:\Users\me>php --info | grep "extension_dir"
extension_dir => ext => ext
C:\Users\me>php --info | grep "php.ini"
Configuration File (php.ini) Path => C:\Windows
Loaded Configuration File => C:\Program Files\php-5.6.8-Win32-VC11-x64\php.ini

Yes, they are. There is no C:\Windows\php.ini, but it doesn't matter -- the C:\Program Files\php-5.6.8-Win32-VC11-x64\php.ini is the file I updated and it's loaded.

Then I printed the modules list (php --modules) and noticed, that it has nothing in common with the extensions setting in the loaded php.ini. I also tried to change other settings (like memory_limit), but PHP seems to ignore my php.ini and load the configurations from somewhere else.

How to detect this magical "somewhere" (means: where PHP actually loads its settings from) and how to make it load the wished settings from the defined file?

automatix
  • 14,018
  • 26
  • 105
  • 230
  • possible duplicate of [Composer install error - requires ext\_curl when it's actualy enabled](http://stackoverflow.com/questions/19335305/composer-install-error-requires-ext-curl-when-its-actualy-enabled) – uri2x Aug 30 '15 at 15:27
  • @uri2x Thanks for you comment. No, this question doesn't duplicate the one you linked to. Actually it's not about composer, it's about PHP on Windows. – automatix Aug 30 '15 at 19:14
  • That's interesting we are using sort of the same setup where we are updating the Loaded Configuration file and that seems to work. – rccoros Oct 21 '15 at 12:48

2 Answers2

0

In my case i was updating the wrong file; i first run the editor as an administrator, then updated the php config file enter image description here

then i activated the extension

enter image description here

i checked that the module is activated using:

php -m

enter image description here

-1

The problem is caused by the fact, that php.ini is being edited by editor that wasn't run with elevated privileges. If the PHP folder sits inside "Program Files", you have to access the files within it with admin privileges. I discovered the unbelievable fact, that the changes aren't saved into the php.ini despite the editor shows them correctly, even if closed/opened! This can be simply verified by checking php.ini content - run more "C:\Program Files\... ...\php.ini" from the command line.

The solution is obvious - you have to run the editor with elevated privileges, or grant user permissions to the folder with php.ini and then edit it.

Jan Rydrych
  • 2,188
  • 2
  • 13
  • 18