0

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"
3
  • Any reason why not on Linux OS? Will be much more easier.
    – Itay Moav
    May 27, 2009 at 18:16
  • I have only windows xp
    – Warrior
    May 27, 2009 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, 2009 at 18:18

6 Answers 6

8

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.

Try: XAMPP

2
  • what you don't like pain?
    – bobobobo
    Dec 16, 2010 at 18:27
  • I tried upgrading xampp from 1.7.3 to 1.7.7 and everything broke. yay Apr 14, 2012 at 22:27
0

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/"
0

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.

0

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

0

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

php.conf

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:

httpd.conf

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
</IfModule>
0

Be careful when you copy and paste from webpages on the web, i had to change the quote marks to "C:/PHP72" (straight) from “C:/PHP72” (curly) to get the service to restart in windows.

Like most web page they are sensitive to the littlest of differences.

Not the answer you're looking for? Browse other questions tagged .