Can't Install PHP in Windows XP

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
oble01
Forum Newbie
Posts: 5
Joined: Mon Sep 28, 2009 3:12 pm

Can't Install PHP in Windows XP

Post by oble01 »

Hi,

I haven't used PHP in a while and the last time I did it was running on Solaris servers that someone else had set up. This time I am trying to install PHP, Apache, and MySQL on my Laptop running Windows XP SP2.

I used the following tutorial: http://www.sebastiansulinski.co.uk/tuto ... windows_xp.

The tutorial suggests installing Apache, then PHP, then MySQL....It advises you on how to configure each conf file etc as you proceed. I kept my directpry names etc the same to avoid confusion.

I got Apache installed and tested by typing http://localhost:8080 which returned the Apache success page.

I then ran through the PHP install where I set the environment variables and when I typed php -v into command line it showed PHP was installed OK.

Next step was to configure Apache to run PHP as a module....This is where I am struggling.

I have edited the httpd.conf file as suggested but afterwards I test the configuration by typing http://localhost/phpinfo.php into the browser. It should return the PHP info expected but instead I get an error in Firefox saying "Problem Loading Page, Unable to Connect".

I have scanned google many times and am starting to get very confused and annoyed. I am new to this forum so not sure what information you guys need from me in order for you to be able to help so if I have missed anything please let me know.

Any help would be very much appreciated guys as I am absolutely exhausted.

Thanks again.

John.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Can't Install PHP in Windows XP

Post by requinix »

oble01 wrote:I got Apache installed and tested by typing http://localhost:8080 which returned the Apache success page.

[...]

I test the configuration by typing http://localhost/phpinfo.php into the browser
*cough*
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Can't Install PHP in Windows XP

Post by John Cartwright »

Moved to Installation and Configuration.
oble01
Forum Newbie
Posts: 5
Joined: Mon Sep 28, 2009 3:12 pm

Re: Can't Install PHP in Windows XP

Post by oble01 »

Thanks guys....

Tasairis....I don't get it mate?

Apologies if I'm missing somethign glaringly obvious :D
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Can't Install PHP in Windows XP

Post by John Cartwright »

oble01
Forum Newbie
Posts: 5
Joined: Mon Sep 28, 2009 3:12 pm

Re: Can't Install PHP in Windows XP

Post by oble01 »

AH...typo there actually, I did try that previously. Since my last post I have formatted my hard drive(had to be done for other reasons), reinstalled OS, and started again using this great tutorial:

http://www.atksolutions.com/articles/in ... l_iis.html

I got IIS installed perfectly.
I got PHP installed perfectly and tested which works great.
I got mysql installed and everything seemed fine.

My final test was to run a script to check I could connect to mysql database. I used the following script:

----------------------------------------------------------------------------
<?PHP
//remember to change the password to whatever you set
//it to in mysql instance configuration

//first parameter is server name, 2nd username 'root', 3rd is password
$rst = @mysql_connect("localhost","root","root");

if (!$rst){
echo( "<p>Unable to connect to database manager.</p>");
die('Could not connect: ' . mysql_error());
exit();
} else {
echo("<p>Successfully Connected to MySQL Database Manager!</p>");
}

if (! @mysql_select_db("mysql") ){
echo( "<p>Unable to connect database...</p>");
exit();
} else {
echo("<p>Successfully Connected to Database 'MYSQL'!</p>");
}
?>
---------------------------------------------------------------------

Whenever I try to open the file (testmysql.php) in IE or Firefox I get a blank screen. I tried opening my phpinfo.php script which returns my PHP info as expected but whenever I run the above script I get a blank screen.

Does anyone have any idea what coudl be wrong? The script looks fine to me, the server name, usernam, and password are definately correct.

Any help is much appreciated guys....I have barely spoken to my wife in three days trying to get this done...Not sure how long she is going to let me away with it :D
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Can't Install PHP in Windows XP

Post by jackpf »

Turn on error reporting in php.ini?
oble01
Forum Newbie
Posts: 5
Joined: Mon Sep 28, 2009 3:12 pm

Re: Can't Install PHP in Windows XP

Post by oble01 »

Thanks jackpf....

I configured php.ini to: display_error = On

Unfortunately I still get a blank screen!

As far as I can see php is installed and workign fine, IIS is installed and working fine, mysql is installed and working fine....The problem I guess is connecting to my database. Is there anythign I need to configure in mysql?

Thanks again everyone for your help with this.

John.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Can't Install PHP in Windows XP

Post by jackpf »

Did you restart apache?

If there's an error connecting to the database, you should see...well, an error.

Try putting

Code: Select all

error_reporting(E_ALL);
at the top of the script.

EDIT
Thinking about it, I think it should be "E_ALL" (no quotes) rather than "On" in php.ini.
oble01
Forum Newbie
Posts: 5
Joined: Mon Sep 28, 2009 3:12 pm

Re: Can't Install PHP in Windows XP

Post by oble01 »

WOOOO HOOOOO!

I can't believe it, I eventually have it working.....The problem was as follows:

Initially I had to rename the "php.ini-recommended" file to "php.ini" and save it in the Windows folder. However, I noticed that although I did this, I also had a php.ini file still resident in the C:/php directory. I deleted the php.ini file from the C:/php directory and everything now works absolutely perfectly!

Thanks a lot for your help guys....I'm sure I will be coming back here often and maybe even returning the favour one day!
Post Reply