Jump to content

PHP installation problem. When I access localhost, i am prompted to download


Recommended Posts

I am trying to create an apache, PHP, and MySQL operating environment on my computer; however, I am having trouble loading the PHP test page.

When I try to access http://localhost/ I am prompted to download "application/x-httpd-php".  I know this line of code was edited when I attempted to install PHP, but I do not know what is causing my browser to act that way. 

 

Just so you know, I included the .php extension at the end of the application/x-httpd-php when I edited the code. 

 

Does anyone know what is causing this to happen?

 

If my ISP doesn't currently allow me to host a website from my own computer, will that prevent me from testing PHP on my computer?

 

 

Link to comment
Share on other sites

Did you restart Apache when made the changes to the httpd.conf? Also how have you configured Apache to handle PHP (Module or CGI)?

 

Thank you for your reply.

 

I did restart my computer; however, I am not sure how apache was configured.  How do I find out?

Link to comment
Share on other sites

What version of Apache do you have installed? if its Apache2.2.x then the loadModule line should be:

LoadModule php5_module c:/php5/php5apache2_2.dll

 

Make sure you have PHP5.2.x installed in order to get this module. Apache2.2.x changed the way how it handles modules. Apache2.0.x modules are not compatible with Apache2.2.x. php5apache2.dll is for use with Apache 2.0.x

Link to comment
Share on other sites

One other thing, after contacting my ISPs tech support, I found out that my ISP does not allow webhosting from my computer.  Will that prevent me from setting up a test environment?

This should not prevent you from accessing localhost (which is an alias to 127.0.0.1).  127.0.0.1 is an internal ip address (or loopback address). My ISP does not condone hosting websites from my computer however I can still use Apache locally.

 

From the problem you are having I'd assume its a configuration issue can you attach your httpd.conf file here.

Link to comment
Share on other sites

Well your configuration works fine here. I'm not sure what the problem might be.

 

Try restoring the httpd.conf to its default settings when Apache was installed, there should be a backup copy of the httpd.conf stored in the conf folder. Look for a file called something like http-default.conf.

 

Rename that backup file to httpd.conf (delete/rename the existing httpd.conf). Restart apache and test a simple html file.  If the html file works fine then start by adding in the PHP config lines one by one. Making sure to save the httpd.conf and restart Apache each time.

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.