Jump to content

Recommended Posts

Environment:

Windows XP.

Apache 2.2.6 installed.

PHP v5.2.6 unzipped into C:\PHP folder.

 

All configuration is completed and identical on workstation #1 and workstation #2.

Testing PHP access on localhost with test.php gives result:

 

Workstation #1: works as expected.

Workstation #2: test.php content is displayed as text instead of being parsed by PHP.

 

I compared and found to be identical the following files:

C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf

C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-userdir.conf

C:\PHP\php.ini

Path environment variable is OK on both workstations.

 

What could be wrong on workstation #2?

 

 

Link to comment
https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/
Share on other sites

Sure I restarted Apache after updates to configuration files. BTW, I'm using Apache as executable (NOT as Windows service).

 

Minor workstation differences:

Workstation #1 (PHP working) - WinXP Pro, my business workstation on intranet. Probably I had PHP installed and uninstalled on this workstation. Some remnants of these former installation may remain.

 

Workstation #2 (PHP fails) - WinXP Home, clean machine.

Are you calling the file from http://localhost/test.php  (I take it you are). And if it shows just plain text, it seems the Apache is not setup to parse php files. You will need to add the type handler I believe.

 

Apache 2 Install on Windows

 

Look at the AddType section, depending if you are running it as CGI or not make sure either of those values are in the httpd.conf if they are not add them then restart apache and see if it works.

Could you explain why the httpd.conf entry:

    AddType application/x-httpd-php .php

is NOT required on workstation #1 and is required on workstation #2?

 

The only thing I could think of is your .htaccess on Workstation1 has it added to it. As it does not "have" to be in the httpd.conf if it is located in .htaccess. It is just better to do it in httpd.conf unless you want to limit who gets PHP access.

No, .htaccess is not involved. I made a copy of the whole folder with all web content stuff from one workstation into another with appropriate updates in the httpd.conf on the destination workstation.

 

I repeated tests by commenting out AddType on workstation #2. The PHP is stopping to work. How it works without this entry on the workstation #1?

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.