Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
Apache / PHP installation/configuration Problems

Posted by Chris_Isaac (Chris Isaac), 16 November 2005

I'm having a bit of a problem with my home setup.  I've installed Apache and PHP, both seem to be working but if I try to view a PHP page it just prints out the source to screen, eg <?php phpinfo(); ?> just prints that on screen.

I tried adding the following lines to the http.conf file:
AddType application/x-httpd-php .php .php4
AddType application/x-httpd-php-source .phps

but that brings up a window message box "do you want to save this file"

ANy ideas where I'm going wrong.

PS. I'm using v2.0.55 Apache and PHP 4.4.1

Posted by admin (Graham Ellis), 16 November 2005
I'm guessing that either you've not installed your PHP where Apache can see it, or you've not restarted the server, or the files you've uploaded have something like at extra .txt on the end of them (notepad and wordpad are very good at doing this).  I would probably check the first option out first - a careful look through the PHP installation notes and check that everything's in the right place.

Posted by Chris_Isaac (Chris Isaac), 16 November 2005
Thanks for the reply Graham.  I've definately restarted the server, and I'm using EditPlus, and its not appending any .txt to the end.

I put php in the standard path, ie, c:/php.  How/where do I tell apache where it is.  I looked on the installation notes and it said the PHP part would be commented out, I did a search on php in the document (http.conf)and there was no trace of it.  Is there a particular part of the file where I need to put the AddType.... bits?



Posted by Custard (Custard), 16 November 2005
Hi, I'm no php expert, but my httpd.conf also has:

LoadModule php5_module        modules/

Which appears to tell apache which module to use.


Posted by Chris_Isaac (Chris Isaac), 17 November 2005
Nope, my http.conf dosen't have any statement with php in it, I'll try downloading apache again, perhaps v1 and see if that helps.

Thanks for the reply guys.

Posted by Chris_Isaac (Chris Isaac), 17 November 2005
I've now downloaded V1.3.33 (think it was that one anyway its close  )

No difference, the php still only shows as the source.  I had a look at the http.conf file, and there is still no reference to any PHP statement.

Is it ok for me to just add it anywhere?

Posted by Chris_Isaac (Chris Isaac), 18 November 2005
I kinda got it working now, at least if the file is located directly in c:/Program Files/Apache Group/Apache2/htdocs then it works fine, but any file in a directory under that it comes up with cannot find file Any ideas why this is happening?

PS, to get it to work I added the following:

ScriptAlias /php/ "C:/PHP/"
AddType application/x-httpd-php .php .php4

# For PHP 4
Action application/x-httpd-php "/php/php.exe"

Posted by Chris_Isaac (Chris Isaac), 23 November 2005
Got it working  

I added the following to httpd.conf to configure apache as a sapi module, also added c:/php to my path and that seems to have fixed it :

LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php .php4

Think the above was suggested by Custard so thanks for that, and thank you Graham for your responses.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho