Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/54853-solved-apache-php-issue/
Share on other sites

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.

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.

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.

  • 2 weeks later...

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

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.

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.