Jump to content

PHP On XP


Recommended Posts

I would like to have php enabled on my computer but whenever im trying to edit any php code it wont display and errors unkown file format and wether you want to select a program to open it or search on the web. So then i have to upload it to my hosting company just to test the code
any know any websites where i could download php software or watever
Link to comment
Share on other sites

Go to http://www.php.net/downloads.php to get PHP(download PHP5.2 and make sure you get the zipped binaries, not the installer!).

Then you will need to get a HTTP server. if you're on XP Pro then you can install IIS. However I prefer Apache. You can get Apache from [url=http://www.mirror.ac.uk/mirror/ftp.apache.org/httpd/binaries/win32/apache_2.2.3-win32-x86-no_ssl.msi]here[/url]. Installing Apache is easy as you just need to run through the onscreen instructions from the installer. However when it asks about Network Domain and Server Name type in [b]localhost[/b] for both then give it a false email address for the administrator password (admin@localhost will do). Now just plough through the remaining installation prompts until Apache is installed. Once it is, open up your web browser and go to the following address:
http://localhost/

When you go there it should display a simple "It Works" message or an Apache welcome screen. If it does then you have successfully installed Apache!

Now you need to install PHP! To install PHP first get the zipped binaries from php.net once you've done that extract the contents of the zip to C:\PHP. Once it has extracted PHP. PHP is installed! However we now need to configure PHP as an Apache module. To do so open up the httpd.conf for editing (Should be in C:/Program Files/Apache Group/Apache2.2/conf)
Now add the following to end of the httpd.conf:
[code]# PHP5
LoadModule php5_module "C:/PHP/php5apache2_2.dll"
PHPIniDir "C:/WINDOWS"
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-phps .phps[/code]
Save the httpd.conf file and restart Apache. Start > Program Files > Apache HTTP Server 2.2.x > Control Apache Server > Restart). If you get no beeps/error prompts then Apache is configured correctly. Now go to C:/Program Files/Apache Group/Apache2.2/htdocs (this is where you put your PHP files), and right click an empty space in the folder and choose New Text Document, rename this new file to test.php. Now open this file in notepad and add the following code to it:
[code]<?php phpinfo(); ?>[/code]

Reopen your web browser and go to http://localhost/test.php you should get a full page of information about PHP configuration and operating environment. If you do then everything is installed!

Hope that helps![/code]
Link to comment
Share on other sites

  • 2 weeks later...
[quote author=tarun link=topic=120152.msg503935#msg503935 date=1168689997]
im not using a server its jst my computer
[/quote]
weknowtheworld ment the server software. Not the hardware. Anyway a server is a computer. ;)

Also did you read my post (3 posts up from this)?

It walks you through setting up PHP and Apache (http server).
Link to comment
Share on other sites

  • 1 month later...
Hello, I stumbled upon this in my quest to solve a php installation/configuration problem.  My system:

Local computer
Apache 2.2 (works well, I get the "It works!" screen)
MySQL 5.0.27
PHP 5.2.1

I followed the steps EXACLY as you mention in your link.

When I type Ctrl+F5, I see test.php in the list.  When I click on it, it only executes the html portion and does not execute the php code.  The test.php file has the following code:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
phpinfo();
?>
</body></html>

I only see the "This is an html line" display on the screen and the "This is a PHP line" does not appear on the screen.

When I type "http://localhost/" I get the following:
Index of /
apache_pb.gif
apache_pb.png
apache_pb22.gif
apache_pb22.png
apache_pb22_ani.gif
test.php.html

When I type "http://localhost/test.php", I get error 404.  Please help!
Link to comment
Share on other sites

[quote author=newbee link=topic=120152.msg537706#msg537706 date=1172345154]
Hello, I stumbled upon this in my quest to solve a php installation/configuration problem.  My system:

Local computer
Apache 2.2 (works well, I get the "It works!" screen)
MySQL 5.0.27
PHP 5.2.1

I followed the steps EXACLY as you mention in your link.

When I type Ctrl+F5, I see test.php in the list.  When I click on it, it only executes the html portion and does not execute the php code.  The test.php file has the following code:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
phpinfo();
?>
</body></html>

I only see the "This is an html line" display on the screen and the "This is a PHP line" does not appear on the screen.

When I type "http://localhost/" I get the following:
Index of /
apache_pb.gif
apache_pb.png
apache_pb22.gif
apache_pb22.png
apache_pb22_ani.gif
test.php.html

When I type "http://localhost/test.php", I get error 404.  Please help!
[/quote]

The error is test.php.html .  rename it as test.php
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.