I have done the procedure below given in http://www.ricocheting.com/server/php.html for installing PHP and Apache. When I start the Apache server, it is displaying "invalid command PHPIniDir". How can I fix this problem?

I wanted to learn PHP. When I started installing I came with this problem.

Editing Apache Conf File

Using Notepad open httpd.conf (should be start-menu shortcut "Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File"). Either at the very beginning or end of the file add the following lines: (NOTE: be sure to change BOTH C:/php parts to the directory you installed PHP to)

LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
  • Any reason why not on Linux OS? Will be much more easier. – Itay Moav May 27 '09 at 18:16
  • I have only windows xp – Warrior May 27 '09 at 18:17
  • 5
    Not a direct answer to your question, but have you considered installing an Apache distribution? I have found XAMPP to be very easy to set up and use: apachefriends.org/en/xampp.html – Perspx May 27 '09 at 18:18

I would recommend you using XAMPP. It is a complete package of Apache, PHP, MySQL and so on... You don't have to configure and you can easily stop the processes so that you don't have an open webserver running on your computer all the time which can be risky if accessible over the Internet.


  • what you don't like pain? – bobobobo Dec 16 '10 at 18:27
  • I tried upgrading xampp from 1.7.3 to 1.7.7 and everything broke. yay – Neil McGuigan Apr 14 '12 at 22:27

I vaguely remember having this problem as well. If I remember correctly you might need to add a trailing / to the PHPIniDir

PHPIniDir "C:/php/"

The only other alternative that I know of to XAMPP is to install WAMP. I've used WAMP many times but I haven't tried XAMPP. They are full LAMP stacks (well WAMP stacks) that contain Apache, MySQL and PHP.


As an alternative, drop the PHPIniDir command and place the php.ini in the same directory as the Apache.exe application.


I created a new file called php.conf. In that file I placed the following:


Loadfile "C:\php\php5ts.dll"

LoadModule php5_module "C:\php\php5apache2_2.dll"

PHPIniDir "C:\php"

AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps

Then I went to my httpd.conf file and included the php.conf file:


Include conf/extra/php.conf

I included the line above, right before these lines in my httpd.conf file, where all the other include lines are.

<IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin

installation of both php and server,,, problems? Try this link on how to install php & apache web server through the use of xampp,, Here is a detailed instruction on how to install-> http://www.laruymuna.blogspot.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.