Jump to content

Recommended Posts

When I try "mysqli_connect" I get the error message that this function is undefined. My php.ini file is read, when I change something in it, it is reflected in the output from phpinfo(). Except that the "extension_dir" doesn't change, it keeps saying "C:\php5", whereas I changed that in my ini-file into "E:\php\ext". I also uncommented "extension = php_mysqli.dll" in the ini-file. I set PHPRC in my system variables to the right path. I have php 5.3 now and I am running it locally on IIS with Windows Vista SP1. Anyone got an idea?

Link to comment
https://forums.phpfreaks.com/topic/168193-extension_dir-doesnt-change-in-phpini/
Share on other sites

I only bring this up because it's nailed me even when I thought I was correct.  Which php.ini file does phpinfo() say it is loading?  Not sure if it applies, but keep in mind the php.ini referenced by command line PHP and www PHP are not always the same.

 

The fact that you say you edited php.ini and changed extension_dir seems to imply you got the wrong php.ini.  The user account PHP (or web server) is running as doesn't have access to read the extension directory or some other such nonsense.

When I change something else in php.ini it shows up via phpinfo(), for example, when I change "display_errors = on " to ".... off" it is shown via phpinfo(). Phpinfo() shows "Configuration File (php.ini) Path: C:\Windows", but on the next line it says "Loaded Configuration File: E:\php\php.ini", the latter is correct.

Loaded Configuration File

That's the file you want to be editing, which you are.

 

Except that the "extension_dir" doesn't change, it keeps saying "C:\php5", whereas I changed that in my ini-file into "E:\php\ext".

That doesn't make sense to me though.  phpinfo() says the extension_dir is c:\php5?

 

Lastly, whatever your extension directory really is, did you make sure the php_mysqli.dll is present and the proper version for your version of PHP?

 

I know that some versions of the postgres dll I've had bundled with my installation have been faulty.

Question 1: Yes, my phpinfo() says the extension_dir is c:\php5.

Question 2: php_mysqli.dll is present. I wouldn't know whether it is the proper version, I downloaded the whole bunch on June 28.

Remark: I previously had a prior version of php5 which was indeed in c:\php5, but when I got 5.3.0. I put it on my E-disk because of space.

I'm not sure if this is relevant at all, but how did you install PHP the first time around?  Did you just extract a zip file?  Or did you run some .msi or .exe installation routine?

 

Are you sure there aren't multiple extension_dir= lines in your php.ini?

 

It makes no sense whatsoever that you can edit php.ini and have the changes take effect but that it ignores your extension_dir= change.  Unless there's some other php configuration value that could affect it, such as safemode or something.

I installed the package: php-5.3.0-Win32-VC9-x86.msi.

 

There are no other 'extension_dir = ... ' lines in my php.ini.

 

I tried to change the extension_dir in runtime:

  echo 'extension dir ' . ini_get('extension_dir');

  ini_set('extension_dir', 'e:\php\ext');

  echo 'extension dir ' . ini_get('extension_dir');

Nope! It remains at 'c:\php5'.

 

Also I tried to put the 'php_mysqli.dll' in the place which the 'extension_dir' expects it, namely 'c:\php5' (I created that directory just for this file). No effect, whatsoever.

 

You cannot set the extension_dir using an ini_set() statement.

 

The .msi installer is bad news. It uses the Windows registry to hold settings and it expects you to use the Windows control panel add/remove (Vista Programs and Features) to manage extensions, which is why you did not find the expected extension .dll's in the folder (it puts them there on an as needed basis.)

 

You either need to use the Windows control panel to enable extensions or you need to manually install php using the .zip package and hopefully if you use the control panel to remove what the .msi installer did it will remove the settings from the registry so that you will get back the control over them.

I would just use Add / Remove programs to remove PHP altogether and use regedit to make sure it's gone.

 

Then extract a .zip distribution and add the path to your environment variables.

 

Then you'll have less problems most likely.

  • 4 weeks later...

OK. I uninstalled php, I downloaded the zip-package. Now nothing is functioning. Why the bloody hell can´t there be a sufficiently intelligent installation package. Or a manual that, on typing in Windows Vista, IIS, gives me help without having to sift out in every paragraph the things important to me? I want to program with PHP, not to try out installation variations hour after hour.

Wherever you unzipped it to, just add that directory to your $PATH environment variable.

 

You can access the $PATH variable by right clicking on My Computer -> Properties -> Advanced -> Environment Variables

 

Just add c:\php; to the front of the existing value.

 

Then if you open a command prompt (Start -> Run -> Cmd) you can type:

php -v<enter>
php -i<enter>
php -m<enter>

 

To see things about your installation.

Well, come on now. It can´t be that simple. Php seems to be installed when I do that. The problem seems to be that IIS doesn´t see my php. 0x8007h007f is the error code,Calling GetProcAddress on ISAPI filter "C:\Windows\System32\inetsrv\isapi.dll" failed. The installation manual says that I should make a connection to "php5isapi.dll", which is nowhere to be found in the zip installation package.

  • 4 months later...

I have the same problem with the php.ini extension_dir setting being overwritten.  I tried uninstalling the .msi version and intstalling the  zip version in C:\php531.  phpinfo() shows other changes I make, but the extension_dir value is always changed back to "C:\php5". 

 

I don't really care if Windows wants to override the extension_dir setting as long as I can still load extensions.  So added a C:\php5 directory, put it in the path variable and copied all of the C:php531\ext dll files there.  I added the lines  "[php_XSL]" followed by "extension=php_xsl.dll " as a test,  expecting to see a listing for PHP_XSL appear in phpinfo().  There is  no sign of the XSL extension, so guess it was not loaded. 

 

What should I try next? 

Thanks for any suggestions.

Bob N

found my problem

 

If there is a syntax error in php.ini,  then the directives that are below the syntax error seem to revert to default values. 

 

I found the problem by changing the seconds in the user_ini.cache_ttl directive and cutting and pasting the line to different places in the file until I found the line that was causing the trouble.  I used a line of  commented capital Xs along with the test line to make it easy to locate as I moved it around,. 

 

BobN

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.