gorokhmn Posted April 23, 2009 Share Posted April 23, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 24, 2009 Share Posted April 24, 2009 Did you stop and start the web server to get the changes made to httpd.conf to take effect? Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/#findComment-817989 Share on other sites More sharing options...
gorokhmn Posted April 24, 2009 Author Share Posted April 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/#findComment-818357 Share on other sites More sharing options...
premiso Posted April 24, 2009 Share Posted April 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/#findComment-818365 Share on other sites More sharing options...
gorokhmn Posted April 29, 2009 Author Share Posted April 29, 2009 Thanks for the link and a hint. It resolves the problem. 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? Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/#findComment-821754 Share on other sites More sharing options...
premiso Posted April 29, 2009 Share Posted April 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/#findComment-821779 Share on other sites More sharing options...
gorokhmn Posted April 30, 2009 Author Share Posted April 30, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/155433-php-does-not-work-with-apache/#findComment-822925 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.