Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting started with Apache and PHP

Status
Not open for further replies.

laruet

Technical User
Jul 11, 2005
6
US
I'm trying to learn PHP, but I can't get my server working to start. I installed Apache server 2 and I can see my local host page, but when I try the test page of it gives me the: Seeing this instead of the website you expected?
This page is here because the site administrator has changed the configuration of this web server.

Is my Norton Virus protector blocking it?
 
laruet,

Does your DocumentRoot contain a file named phpinfo.php? What's in that file?

Does your http.conf contain these lines?
AddType application/x-httpd-php .php .php4
AddType application/x-httpd-php-source .phps

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
I did add some AddTypes application lines, but they were a little different in my book, but I added your lines in http.conf file, but used php5 instead of php4. When I try to go to it is still the same. I get a dialog box that comes up saying: "do you want to save or open this file, if you push the open button then it opens the phpinfo.php file in Dreamweaver".
 
laruet,

Sorry about assuming you were using PHP 4. I also shouldn't assume that you restarted Apache since making any changes, but you did, right?

What do you get for the output of 'apachectl -v'?

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
I did restart the apache and got the same results. I'm running this on Windows XP. Is apachectl-v for Unix? I have about 5 book here and I can't find how to get the output of apachectl-v. I appreciate your efforts.
 
You executables should be in the /bin directory. You should have a path to it so you don't have to change to that directory every time you need to execute a command. You should also have the directory the holds the php executables in your path also. To check, type "set" on the command line. You will see path= with a list of paths after it delimited with a semicolon ";".
 
Apache does'nt recognize how to process the .php extensions. In addition to wishdiak's comment, I also have a load module and an action directive for php.

I'm not sure I need both, but I got it working this way.

Restart apache after each change to the httpd.conf file.

# change path to suit your environment
LoadModule php4_module d:/php/sapi/php4apache.dll

# I would think this redundant to LoadMod above
Action application/x-httpd-php "/php/php.exe"
 
I already have:
LoadModule php5_module c:/php5/php5apache2.dll
in the httpd.conf

I still get the dialog box that said:
Do you want to open or save this file?
Name: phpinfo.php
Type: Microsoft Picture IT! Document 19 bytes
From: localhost

 
I finally got it to work, but I'm not sure what I did that made it work. The AddType seemed to be the problem. This is what I finally used that worked: AddType application/x-httpd-php .php3 .php. Each of my PHP books had a different idea of how to difine the MIME types.

Thankyou for all your help.

LaRue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top