Jump to content
xisto Community
lonebyrd

PHP Problems

Recommended Posts

O.K. I feel totally computer illiterate right now. I just downloaded PHP 5 with the installer, and I can't get the test page in the tutorial to come out. I was using WAMP but I couldn't figure that out. Let me explain my problem.

When using WAMP, it said to make a directory in the www folder which I did. After doing that, I did a test page from a tutorial in notepad and saved it in that directory then tried to open it using WAMP. That didn't work. Then I tried opening using http://forums.xisto.com/no_longer_exists/ and that didnt work.

Now when using the PHP installer, it asks if I want to install with PWS windows 9x or some things called IIS 3,4, or 6. I don't know if I picked the right one. But once again, I did that test page, but when I went to open it, I browsed for something in PHP to open it with and there was nothing.

Shouldn't PHP just come up on the screen normally? Or do I have to open everything in a PHP folder? I'm confused and frustrated and can't get anything to work.

Share this post


Link to post
Share on other sites

First of all, start-up the server and your Browser. Simple so far.
In the Browser Address bar, type in :

http://localhost/folder/[subfolder/]file_name.php
where the folder/[subfolder/]file_name.php is below the 'server-root' for the local installation.
I have an XAMPP set-up on my machine and the windows file path is something like :
c:/apache/xampp/htdocs/folder/filename, where c:/apache/xampp/htdocs is the server-root, so in my browser I type
http://localhost/folder/[subfolder/]filename
The stuff inside the square brackets is optional if the file path does not require it.
Edited by jlhaslip (see edit history)

Share this post


Link to post
Share on other sites

First off PHP is a server side language like Perl and must be run on a server. All web servers have a ROOT directory (in the case of WAMP I believe it is C:\wamp\www but could possibly be anywhere on your hard drive but the www directory (folder) will reside within the wamp directory folder wherever it might happen to be.

 

When you write a PHP file it must be placed on the webserver somewhere in the ROOT (www) and you may add subdirectories to this folder for your own organizational purposes. So lets take a simple Hello World script and do just that and then test it.

 

Create the below file as is and then save it on your hard drive to the www folder or directory (whatever you call it). Then open your favorite browser and type into the address bar LOCALHOST/hello.php.

<?phpecho "<center><h1>Hello World from PHP!</h1></center><br />";echo "My PHP install is working correctly, now for bigger and better things!";?>
This should ouput to the screen a centered large headline saying Hello World from PHP! and a line with left justification saying My PHP install is working correctly, now for bigger and better things! PHP can generate HTML and that is what the above code does. If after doing the above and the file is in the proper location of the webserver (Apache with WAMP) it should work, otherwise you have a corrupt install and need to uninstall and reinstall the program. Normally with WAMP or XAMPP or Triad and such if you just accept the default values you should have no problems provided that you place the PHP and HTML files in the proper directory.

Share this post


Link to post
Share on other sites

Now when using the PHP installer, it asks if I want to install with PWS windows 9x or some things called IIS 3,4, or 6. I don't know if I picked the right one.

What did you pick? I'm not familiar with the PHP installer, but surely you didn't pick PWS or IIS? If you have WAMP, that means you're using Apache.

W - Windows
A - Apache
M - MySQL
P - PHP

If there was no Apache option, then you can't use the installer (or you just have to update your .conf files manually)... at least that's how it used to be. Last time I used the installer was back in the PHP3/early-PHP4 days...

- Jared

Share this post


Link to post
Share on other sites

The thing houdini said should work. But if you did NOT create a index.php or index.html page, you can do this ( if you did, try to change the name to something else like test.php [only for testing, it is really recomended that you have an index page in the root folder, but now, just test]).

 

Try to type this in you web-browser when your server is on.

Now, you should see all the files and folders in the root folder (WWW). Now just search for the folder/file you created and press on it. that should work just fine.

Share this post


Link to post
Share on other sites

If yor are using Windows OS then you can use WAMP,XAMPP which comes in package of PHP,Mysql and Apache server.There may be one problem while installing this package i.e there may IIS installed on your system using port 80 which will give problem.As apache by default will be installed on port 80.So easy way is to uninstall IIS or else change the port.PHP can also be used with IIS as a server.You need to install PHP and Mysql seprately and use IIS.Hope this information helps.Yogesh Gadiyayogeshgadiya@gmail.com

Share this post


Link to post
Share on other sites

A quick way to check if the installation worked is to go into your browser, type localhost and press enter. If you do not see anything come up, you are either using Microsoft Internet Explorer, which needs some persuasion by typing in the http-colon-double-slash, or the webserver has not been setup yet. If the Microsoft Internet Information Services (IIS) page comes up in the browser, then Apache has not been properly setup. I'm not too sure about the WAMP setup, but the XAMPP setup is incapable of changing the port that Apache runs on since most people don't need to change the default port or prefer to change the port number themselves through the configuration file. A quick peak into the httpd.conf or the apache.conf configuration file should lead you down to a configuration setting for the port number - look for "Listen 80" and replace it with a "Listen 81" to get Apache to run on port 81 instead of port 80; save the file and restart... Apache, not your computer :-)Then, fire up your web browser again and type in localhost:81 - note that you do not have to type in the port number when you are using port 80 because it is the standard port number for HTTP web traffic.If you still have problems, post a reply to ask :-)

Share this post


Link to post
Share on other sites

To add my two cents, usually WAMPServer doesn't install due to Skype or some other application is using port 80, so apache can't start, due to it's listening to port 80.Just remove the feature in Skype settings, to let Skype use port 80 and software like XAMPP or Wampserver will install without any problems on Windows. :)

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

×
×
  • 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.