Whatterz


PHP.ini Permission Problems on Windows Vista

by Simon. Average Reading Time: about a minute.

Installing PHP is a relatively simple task one would think. Indeed it is simple, but configuring the php.ini isn’t; at least not so on Windows Vista! It is infuriating when such a relatively simple task is made inordinately complicated because of the nuances of Vista permissions. What started out as a 5 minute task took a significant number of hours searching for a suitable answer on Google, and not only by myself.

The task I was trying to achieve was the installation of development versions of WordPress, Drupal, MediaWiki and Moodle, all of which would require a MySQL database. Trying to load the MySQL extension should have been a simple case of uncommenting the line in the php.ini and restarting the Apache service. With Vista, this was certainly not the case.

I set up a very simple page detailing the php configuration in an index.php file:

< ?php phpinfo(); ?>

This showed me the default configuration path of my php.ini and extensions directory, amongst a whole host of other information.

In both cases the paths were incorrect. First and foremost the configuration file path stated C:\Windows when in fact I had installed it in the root (C:\PHP5). So, although I was amending the php.ini file with the correct detail, Vista was using the default values. If there is no php.ini file in Windows, then you’ll continue banging your head against a brick wall.

The problems didn’t stop there. Moving the php.ini file to the Windows directory under Vista isn’t a simple copy and paste task. You need to be administrator. But Vista’s administrator priviledges are more pseudo than actual! In order to amend and save the php.ini file in the Windows directory, you must run Notepad as administrator and save the file as such. Voila! Everything then works. The phpinfo() function returned the correct installation detail and I could continue with the job I was meant to be doing.

PS. Thanks to Rob Douglas for his help.

This article has been tagged

, , , , , , , , , , , , , , , , , , ,

Other articles I recommend

Configuring PHP with Apache on Windows Vista

Installing PHP with Apache on Windows Vista is a relatively simple task until you try an configure the settings in php.ini. Problems can occur and stem from the fact that when you install PHP and edit the php.ini file, you need to not only be logged in as Administrator, but run the installer and Notepad text editor as Administrator. The php.ini file also needs to be located in the Windows directory.

Installing Apache on Vista

Following the purchase of a spangly new Toshiba laptop running Vista, and not one for making life simple, I decided not to run my development environment on IIS7, but rather, I wanted to install the latest version of Apache. The installation process was not a trivial matter!

Configuring Your First Local Apache Website

Apache is controlled by a series of configuration files but the one we will be dealing with here is httpd.conf. This file contains instructions on how Apache should run. Several companies offer GUI-based Apache front-ends, but it’s easier to edit the configuration files by hand.

  • Thomas Tallyce

    Good set of articles; your writing is very clear.

    I wonder if you have come across the same problem that I have on WinVista/Apache2/PHP5:

    I set my PHP ini settings in httpd.conf (either in the vhost or on a per-directory basis), so that each site can have its own settings, and the whole server be locked down easily without having to modify php.ini at all.

    I’ve found however, that on Vista, periodically, the include_path value just gets forgotten about, and I have restart from the start menu with right-click > ‘Run as administrator’. After restarting, the include_path setting is then correct again, and the site functions fine.

    (Having diffed a phpinfo() output page before and after this problem, I see the only changes are the Local Value for include_path, mbstring.internal_encoding and HTTP headers > Keep-Alive.)

    Have you come across this? I’m baffled.. it’s as if it just forgets the setting after a while, and I can’t think why this is happening.

  • Pingback: gcfrench: Installation()

  • Annoyed

    Fuck php. I’ve had trouble every single time I’ve installed it for IIS, or tried to upgrade it. Itself, it is great, but no developer for PHP has taken the time to make installation simple.

  • Amadi

    hi,
    please could you give me the step by step process of correcting the path issue; C:\Windows. am i to change the setting to locate the php.ini file in the windows directory or can modify the settings to load forom C:\php5.

    thanks
    emma