dmcdivitt Posted March 23, 2010 Share Posted March 23, 2010 My machine was reimaged and I had to reinstall everything. Now I can't get PHP to process any scripts. The scripts are displayed as if a text file. This morning I uninstalled PHP and Apache and reinstalled. My Apache config file has: #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir "C:/Program Files/PHP/" LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll" #AddType application/x-httpd-php .php #AddHandler application/x-httpd-php .php #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL I've tried with and without AddType and AddHandler. I have Win XP SP3, Apache 2.2.15, and PHP 5.3.2 installed as Apache module. Also I have IIS 5.1 running on port 82. I need that for classic ASP pages. Everything was working fine before my machine was reimaged. Help please! Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 23, 2010 Share Posted March 23, 2010 What does your php code look like (show us the opening php tag in the file also)? Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030561 Share on other sites More sharing options...
dmcdivitt Posted March 23, 2010 Author Share Posted March 23, 2010 <?php phpinfo(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030563 Share on other sites More sharing options...
PFMaBiSmAd Posted March 23, 2010 Share Posted March 23, 2010 These would be the minimum lines needed - PHPIniDir "your_actual_path_here" LoadModule php5_module "your_actual_path_here/php5apache2_2.dll" AddType application/x-httpd-php .php Did you stop and start the web server after making any changes so that they would take effect? Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030569 Share on other sites More sharing options...
dmcdivitt Posted March 23, 2010 Author Share Posted March 23, 2010 Yes, I stopped and started the server each time. Just now I tried changing to CGI instead of Apache module. No difference. The PHP extension does not seem to be recognized or it's being masked, but I don't see how. IIS is running on another PORT. All my ASP.NET applications run through the Apache server fine via mod_aspdotnet, so the Apache server is recognizing and processing different file extensions. When I install PHP I don't use the IIS option but one of the Apache options. Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030572 Share on other sites More sharing options...
PFMaBiSmAd Posted March 23, 2010 Share Posted March 23, 2010 PHP INSTALLER EDITS It would appear that you are using the php .msi installer package? If so, good luck. You should manually install php from the .zip package. Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030578 Share on other sites More sharing options...
dmcdivitt Posted March 23, 2010 Author Share Posted March 23, 2010 I've never had an issue with the MSI installer package before. I did try something which had an effect. I change the Apache config to the following: #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir "C:/Program Files/PHP/" LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll" AddHandler application/x-httpd-php phpz php #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL This told it to use the file extension PHPZ in addition to PHP. That worked. If I rename a .php file to .phpz, the script runs properly. It won't run as .php though. I will download the zipped version of PHP and see if that makes a difference. I don't think it will though. Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030580 Share on other sites More sharing options...
PFMaBiSmAd Posted March 23, 2010 Share Posted March 23, 2010 Are there any other instances of 'php' settings in your httpd.conf file? Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030583 Share on other sites More sharing options...
dmcdivitt Posted March 23, 2010 Author Share Posted March 23, 2010 No. I have an application defined as follows. If I put the PHPZ file there it works. #php Alias /php "C:/websites/php" <Directory "C:/websites/php"> Options FollowSymlinks Indexes Order allow,deny Allow from all </Directory> Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030586 Share on other sites More sharing options...
dmcdivitt Posted March 23, 2010 Author Share Posted March 23, 2010 RESOLVED I uninstalled PHP that was done via msi file, unzipped the PHP zip file to c:\php and placed the following in Apache config: PHPIniDir "C:/php/" LoadModule php5_module "C:/php/php5apache2_2.dll" I had the AddHandler line too, but upon trying without it I left it commented out. Apache says all virtual paths are scripted by default which is why the AddHandler isn't necessary. Having Apache read PHP from c:\Program Files is identical to c:\php. As mentioned earlier the PHPZ extension was working so that proves PHP was working. I like doing the zip version better because no install/uninstall is necessary. All that's required is to replace files at c:\php. I don't know what fixed the problem but I'm not going to worry about it. Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030650 Share on other sites More sharing options...
dmcdivitt Posted March 23, 2010 Author Share Posted March 23, 2010 The problem I was having was a result of pages being cached in the browser. It was only by chance I got it to work at all! I assume I just happened to refresh the page I was testing with, otherwise it wouldn't have worked. Following that some pages were working and others not. When I reset the cache everything worked. Quote Link to comment https://forums.phpfreaks.com/topic/196240-php-pages-display-script-instead-read-and-tried-everything/#findComment-1030721 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.