tarun Posted December 28, 2006 Share Posted December 28, 2006 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 codeany know any websites where i could download php software or watever Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 28, 2006 Share Posted December 28, 2006 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]# PHP5LoadModule php5_module "C:/PHP/php5apache2_2.dll"PHPIniDir "C:/WINDOWS"AddType application/x-httpd-php .php .phtmlAddType 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] Quote Link to comment Share on other sites More sharing options...
weknowtheworld Posted January 10, 2007 Share Posted January 10, 2007 Are you using IIS or Apache as the server for PHP. Quote Link to comment Share on other sites More sharing options...
tarun Posted January 13, 2007 Author Share Posted January 13, 2007 im not using a server its jst my computer Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted January 13, 2007 Share Posted January 13, 2007 [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). Quote Link to comment Share on other sites More sharing options...
newbee Posted February 24, 2007 Share Posted February 24, 2007 Hello, I stumbled upon this in my quest to solve a php installation/configuration problem. My system:Local computerApache 2.2 (works well, I get the "It works!" screen)MySQL 5.0.27PHP 5.2.1I 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 Link to comment Share on other sites More sharing options...
tarun Posted February 24, 2007 Author Share Posted February 24, 2007 It's Beacuse You've Saved The PHP File As A HTML FileOpen The File Up In Notepad And Click File>Save AsAnd Save It As test.php Quote Link to comment Share on other sites More sharing options...
worldworld Posted February 26, 2007 Share Posted February 26, 2007 [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 computerApache 2.2 (works well, I get the "It works!" screen)MySQL 5.0.27PHP 5.2.1I 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.