Loran Posted June 9, 2007 Share Posted June 9, 2007 Hi, I've recently installed Apache, (2.2.4), which works fine, then I installed PHP 5, and put phpinfo on a page and ran it through apache..but no php showed up..when i installed PHP 5, it automatically edited the config file for apache..but it doesn't seem to work, and I can't find any other instructions for this sort of problem. Any and all help appreciated. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 9, 2007 Share Posted June 9, 2007 I guess you used the installer. When installing PHP it is best to not use the installer. Instead download the zipped binary package, Not the source code. Once you have downloaded the zip binary package just extract the zip to where you installed PHP to (I presume its C:/php and not C:/prgram files) and overwrite existing files. Once extracted open up your httpd.conf file which will be located in C:/Program Files/Apache Foundation/Apache2/conf. Note your path maybe different. Then just add the following lines to the httpd.conf: LoadModule php5_module "C:/php/php5apache2_2.dll" PHPIniDir "C:/php" AddType application/x-httpd-php .php Save the httpd.conf and restart Apache. It is important your restart Apache when you make any changes to Apache or PHP configuration. Quote Link to comment Share on other sites More sharing options...
Loran Posted June 10, 2007 Author Share Posted June 10, 2007 ok I've unzipped the files..and it doesn't matter if its in C:/Program Files/PHP does it?, thats where it is at the moment. There was something about an existing php file being password protected..didn't know what was up so I just uninstalled PHP, then unzipped, made the correct changes to the httpd.conf file, and in the apache localhost root folder, i have a file named index.htm, with <?php phpinfo(); ?> But it is not showing what it should.. Also im using firefox, and down the bottom left it tells me (i think this is an add on i installed) what server the page is using or similar stuff like that, on my page it says "Server: Apache/2.2.4 (Win32) PHP 5.2.3" Just wondering if this means if apache is actually picking up PHP properly and something else is happening along the way. Thanks for all your help. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 10, 2007 Share Posted June 10, 2007 Save the file as index.php not .html. All PHP code must be in a file ending with a .php file extension. As for where to install PHP/Apache to I prefer not to install into C:/Program Files. I prefer to install AMP (Apache, MySQL and PHP) in the root of the hard drive placed in a folder called Server. I prefer to keep paths as short and as simple as possible. This is my directory listing when AMP is installed C:/Server | +-- Apache | +-- MySQL | +-- PHP | +-- www The www folder is where I place all my .php/html files to. I have configured Apache to serve C:/Server/www rather than the default htdocs folder. Quote Link to comment Share on other sites More sharing options...
Loran Posted June 11, 2007 Author Share Posted June 11, 2007 Ah, thanks a lot, for some reason I was thinking, "Yeah sure you can have php in a page with a .htm(l) extension..what a mistake :S. Thanks for your time and great amount of help. Quote Link to comment Share on other sites More sharing options...
andytymeiz Posted June 22, 2007 Share Posted June 22, 2007 Hi, I am new to this and wish to get Apache 2.2.4 working with php 5.2.2.2 - have followed the steps in this fix and still find that firefox brings up the code not the output as expected. Any suggestions greatly appreciated. I did notice that the php installer wrote to the httpd file: PHPIniDir "C:\PHP\" whereas the fix here suggests: PHPIniDir "C:/php", being a rank amateur, I don't have a clue which is correct. I did save the test file as .php TIA Andy Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 22, 2007 Share Posted June 22, 2007 It doesn't really matter whether you use / or \ in file paths. However really for Windows you are supposed to use \ in paths. Also I generally stay clear of the installer. IMO it is best to manually configure Apache instead. Also make sure any changes you make to Apaches config file (httpd.conf or even php's (php.ini) make sure you restart Apache for the changes to take effect. Quote Link to comment 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.