Jump to content
xisto Community
Sign in to follow this  
Imtay22

How To Install Php Locally? Help?

Recommended Posts

I downloaded PHP 5.2.1 win32 installer and apache. Now what? I tested apache, and it came up with a message saying- It works! So, now what? how do I get php scripts to run using the localhost? What i mean is, where do I save the files so I can view them? Please Help!!!

Edited by Imtay22 (see edit history)

Share this post


Link to post
Share on other sites

I'm guessing you just performed a typical Apache installation, meaning if you want your files to get "picked up" by the server, place them into your "htdocs" folder that is located in the Apache directory. Delete all files in there if you want, then just put all your site's files in there. To see if it shows your site, of course, go to LOCALHOST/ or http://forums.xisto.com/no_longer_exists/. This is all said with the assumption that you have set up Apache to load up with PHP support.

Share this post


Link to post
Share on other sites

I think Truefusion covered most of things, though remember that you need to have apache running to view your pages using the address TF posted above. To turn php on you will usually have either a "control panel" type program in your start menu or a program like "start php" or something like that.

Share this post


Link to post
Share on other sites

Next thing will be to download and install a mysql Server from mysql.com. The easiest method to get up and running is to download and install all of these using XAMPP or WAMP. XAMPP is a single-click package that loads PHP, Apache, mysql, phpadmin, an FTP Server, a Mail Server and a bunch of stuff. There is a Tutorial around here that explains some stuff about it. If you have any questions, keep asking here.

Share this post


Link to post
Share on other sites

Well it seems like no one answered your question here yet as it appears. You may place php where ever you want on your computer however you have to adjust then your apache configuration file so that it knows where to search for the other classes and so on. If you don't know how to do it I'll write here a short tutorial in the folder where you have installed your apache server you should find this file and open it in any text editor httpd.conf and then you should find this line AddType application/x-tar .tgz and after this line you should write this or post it:

ScriptAlias /php/ "c:/inet/php/"AddType application/x-httpd-php .phpAddType application/x-httpd-php .php3AddType application/x-httpd-php .php4AddType application/x-httpd-php .htmAddType application/x-httpd-php .htmlAddType application/x-httpd-php .phtmlAction application/x-httpd-php "/php/php.exe

Then save the file and voala you've got yourself configurated apache with php.

But I would like to point that the best thing to use is xampp it is freeware software which sets up on windows based platform apache then php mysql and several other thing like mail server and so on and it can be easily extended.

Good luck in programming.

Share this post


Link to post
Share on other sites

Can't find that line, but i found a simalar one-

#AddType application/x-gzip .tgz

Should I place that under that one?

@ Everyone else-
I put my php files there and now all it comes up as is this-

switch($page){

case 'idx' linenums:0'><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"><title>Testing PHP include functions.</title></head><body><a href="?p=idx">Index</a> - <a href="?p=test">Test Page</a><?php$page=$_GET['p'];switch($page){case 'idx':include (".../includes/testphpinclude.html");break;case 'test':echo 'Test!';break;</body></html>
That is the code I put in the php file. Still help? Oh yeah, when I installed php, It auto configed the Apache Server.

Share this post


Link to post
Share on other sites

If you are using Windows along with the latest version of Apache then you need to put your files into the following folder: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

 

As PHP has automatically detected and configured your Apache installation, no changes to the configuration files should be necessary. Make sure Apache is actually running before trying to load the files. You should have a system monitor on the taskbar next to the clock. It's a pink feather with a dot at the bottom. If the dot is red then Apache isn't running. You need to left click the feather, choose Apache 2.2 and then Start. The dot should turn green, signifying that Apache is up and running.

 

Also, to make sure PHP picks them up, make sure the files have the .php extension, and the starting and ending PHP tags. Your example above is missing the closing ?> PHP tag.

Share this post


Link to post
Share on other sites

Whoops, guess i forgot the closing tag. I just restarted Apache, so I will try it after i put the closing tag back on there. Thanks!

EDIT- Now it is appearing as nothing! I added the closing tag, restarted Apache, went to http://forums.xisto.com/no_longer_exists/ and nothing!

Edited by Imtay22 (see edit history)

Share this post


Link to post
Share on other sites

Well, if you want a complete tutorial on how to install more things along with Apache and PHP, you can check out a tutorial i made on my website. Though, i must admit the section on PHPMyAdmin is a bit out of date, for the newer versions don't require you to edit anything, really.
[hr=noshade]Also, try this code:

switch($page){
case 'idx' linenums:0'><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"><title>Testing PHP include functions.</title></head><body><a href="?p=idx">Index</a> - <a href="?p=test">Test Page</a><?php$page=$_GET['p'];switch($page){case 'idx':include (".../includes/testphpinclude.html");break;case 'test':echo 'Test!';break;}?></body></html>[/hr]

Share this post


Link to post
Share on other sites

It seems odd that its not working, perhaps just write a very simple php page with just an ECHO in it to see if it works or not. then follow the steps already said about putting it in the right place and such. If it still doesnt work i would suggest trying XAMPP as its very easy to install and use. Uses a simple installer and an even simpler control panel for starting and stopping php, sql, mail servers, and ftp server. You can google the name and normally find it near the top if you wanted to use it. If you want to keep trying with this then i would use just the ECHO command and if it works you will see the text and if not you will get some sort of error. Also if you did not delete the original php files you could find where they are located and make sure your php files are in the same directory. And you might want to try taking down any firewalls you have as some of them might get a little worried about accessing the localhost. Mine gave me lots or alerts when i was using FF to access the localhost address, that was until i made a rule for it so try that too.

Share this post


Link to post
Share on other sites

i think you have one extra dot in your include code..

include (".../includes/testphpinclude.html");

should be

include ("../includes/testphpinclude.html");

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.