PHP.ph

16 Jul, 2008

Windows: Installing PHP 5.2.6 on Apache 2.2.9 Manually

Posted by: php In: Apache|PHP|Windows

 This is a continuation from the previous topic Apache on Windows.

Download the latest php-x.y.z-Win32.zip at http://www.php.net/downloads.php .

Unzip the contents of php-5.2.6-Win32.zip package to C:\PHP folder.

Find and rename the file php.ini-recommended to php.ini.

Open the file php.ini, look and uncomment the following directives (Click Edit > Find or Ctrl F). Uncomment – remove the ; before a directive to activate it.

display_errors = on
register_globals = off
magic_quotes_gpc = on
extension_dir = /PHP/ext
session.save_path = /tmp Create a folder named TMP under the root directory (Drive C:)
extension=php_mbstring.dll
extension=php_mysql.dll

Attach PHP to Apache as a module. Open the Apache configuration file (C:\Program Files\Apache Software Foundation\Apache2.2\Conf\httpd.conf).

Search for LoadModule. Add this at the end:
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule php5_module "c:/php/php5apache2_2.dll"
PHPIniDir "C:/PHP"

Search for DirectoryIndex and add index.php .
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

Add the following under <IfModule mime_module>:
AddType application/x-httpd-php .php

Copy libmysql.dll file from your C:\PHP folder to the C:\WINNT\system32 directory or C:\Windows\System32 directory(Windows XP).

Restart Apache.

To Test PHP

Create phpinfo.php, type:
<?php echo phpinfo(); ?>

Save as phpinfo.php in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\

Open a browser and point to http://localhost/phpinfo.php or http://127.0.0.1/phpinfo.php .
phpinfo

phpinfo2

19 Responses to "Windows: Installing PHP 5.2.6 on Apache 2.2.9 Manually"

1 | arthur

July 16th, 2008 at 4:35 pm

Avatar

Good article,add Favorite to the Life Style website,the link here:

http://bookmovie.org/IT/Windows_Installing_PHP_5-2-6_on_Apache_2-2-9_Manually/

2 | Binu

July 25th, 2008 at 11:06 pm

Avatar

it’s been 3 days since i’ve been banging my head. PHP just wouldn’t work. Forbidden Server and what not.

Finally, thanks to you, it’s up and running!!!!
Keep up the good work.

3 | xxxxxx

July 27th, 2008 at 3:38 pm

Avatar

Mine is not working. phpinfo.php is not loading

4 | php

July 29th, 2008 at 5:39 pm

Avatar

Mine is not working. phpinfo.php is not loading

Have you solved this already?

5 | Nonstate

August 13th, 2008 at 12:59 pm

Avatar

Same as ‘xxxxx’. Trying to bring up phpinfo.php throws a 404.

6 | php

August 14th, 2008 at 9:16 pm

Avatar

See if the file exists in htdocs. Maybe you saved it as type .txt
Did you insert this string?
AddType application/x-httpd-php .php

8 | New

August 31st, 2008 at 12:43 am

Avatar

Editing php.ini doesn’t help. I’m changing display_errors to ON, saving php.ini restaring PC and give’s me display_error OFF. Apache reading php.ini from say C:/PHP/ where im trying to modify. I’v also put the copy of php.ini into C:/windows directory. Nothing helps. PHP version 5.2.6 Apache 2.2.8. Thanks a lot.

9 | ewal

August 31st, 2008 at 2:58 pm

Avatar

http:// localhost/phpinfo.php doesn’t work but http:// 127.0.0.1/phpinfo.php does work. why?

10 | pfree420

September 15th, 2008 at 1:32 am

Avatar

I can browse http://localhost:8080/info.php which resides in c:\Program Files\Apache Software Foundation\Apache2.2\htdocs\info.php and contains:

BUT

When I try to run a simple script, from an html file, for example: http://localhost:8080/helloworld.html which contains:

First Name

The “firstname” Form displays. Then, I enter garbage in the input box, hit enter and I get the following error message:

Notice: Undefined variable: firstname in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\helloworld.php on line 3
Hello World,

As you can see the garbage (literally anything I enter) does not display after “Hello World,”

So, why is my script not being included at execution time?

Here’s the helloworld.php:

Thanks in advance
pfree420

11 | stel

September 22nd, 2008 at 8:00 am

Avatar

You are great. Finally got everything working cause of your help

12 | Ines

September 28th, 2008 at 10:48 pm

Avatar

U r awesome..Finally a good walkthrough!!Thank you very much…

13 | Arc

October 11th, 2008 at 4:07 pm

Avatar

Hi,

This is not working for me. phpinfo page is blank.
Versions: Apache 2.2.9, PHP 5.2.6 , windows xp

Apache error log is clear, it is saying about php :
[Sat Oct 11 11:02:26 2008] [notice] Apache/2.2.9 (Win32) PHP/5.2.6 configured — resuming normal operations

Any idea?

PS:Sorry about my English.

14 | Stefan Kaehler

October 14th, 2008 at 5:19 pm

Avatar

Thanks dude, i was trying it 3 hours to run mysql,apache,pear and symfony. now it works perfect, thanks!

15 | scott

October 14th, 2008 at 6:29 pm

Avatar

Thanks this really helped been banging my head against a brick wall trying to find out why my php wasnt working when apache was, I used to have this installed on old computer and worked fine but could not get it working on this one but thanks to your help am back up and running :)

16 | Chris

October 30th, 2008 at 5:43 am

Avatar

I follow all the steps. But when i pull up phpinfo.php is blank. It does pull up, but its blank. Where did i go wrong?

17 | kookimebux

February 2nd, 2009 at 4:03 am

Avatar

Hello. And Bye. :)

18 | Jeff

March 2nd, 2010 at 7:51 am

Avatar

Thank you! You got me running. It was the copying of libmysql.dll to the windows/system32 folder that no one else had mentioned…

Thanks again.
JS

19 | hussain

September 1st, 2010 at 6:30 pm

Avatar

Wow. .. thanks alot

Comment Form

Categories

Links

PHP.ph is owned and managed, since 2002 by:
Dr. Jesus Lecitona
Visit his blogs about dentistry:
Denture
Dentures
Dental Implants Cost

About PHP.ph

Linux Apache MySQL PHP