Integrating PHP into Apache

Hi, I am very new to all this PHP, but I am stuck on one thing, everything is ok except when I type in my test page (hello.php) in the broswer it ask “do I want to download”, I will paste the Instructions below (which I Have followed) and maybe someone can help me with this…Thanks to all…

Ps: I have installed to c:/webphp/ (although d: is my main drive)

[LIST=1]
[][SIZE=2]Integrating PHP into Apache[/SIZE]
[LIST=1]
[
]Remember our Apache configuration file? **Open *up C:\web\conf\httpd.conf again and search “LoadModule”. You will see a bunch modules commented with the # character. Paste in:
[FONT=Verdana, Arial, Helvetica, sans-serif][COLOR=#003399]LoadModule php5_module “c:/web/php/php5apache2.dll”[/COLOR][/FONT]
[]Continuing on, look for this: “#AddType text/html .shtml”. Underneath it,
place:
[FONT=Verdana, Arial, Helvetica, sans-serif][COLOR=#003399]AddType application/x-httpd-php .php
AddType application/x-httpd-php .inc[/COLOR][/FONT]

[SIZE=2]We just told Apache to parse .php files and not set them as downloads since it is an unknown extension.[/SIZE]
[][SIZE=2]Last but not least, lets set index.php as a valid directory index,* like index.html. Search for:
[/SIZE][SIZE=2][COLOR=#003399]DirectoryIndex index.html index.html.var[/COLOR][/SIZE][SIZE=2]
and replace the line with:
[COLOR=#003399]DirectoryIndex index.php index.html index.html.var [/COLOR][/SIZE]
[]Save and close the httpd.conf file. Restart Apache by clicking the service monitor in your task tray and navigating to the 'Restart ’ button.
[
]Inhale*,* exhale. You have just completed building your own web server at a beginner’s stage*,* with [FONT=Georgia, Times New Roman, Times, serif]style[/FONT].[FONT=Verdana][SIZE=1] [/SIZE][/FONT][/LIST][LEFT]Wanna test it? Okay a little ‘Hello World’ wouldn’t hurt. [/LEFT]
[/LIST]

Hi

did you restarted the apache server?

Make sure that the LoadModule path to the php5apache2.dll file is correct. If you installed PHP to c:/webphp/ it may need to be c:/webphp/php5apache2.dll

Yes to Both: restarted apache server & confirmed that the loadmodule is correct…

Okay, well I’m not sure what setup instructions you followed so a few other things to look for…

  1. Make sure the php.ini file is in your apache2 directory

  2. Check your apache2 root to make sure that you have the PHP .dll files there as well. I forget which ones are all needed so I looked online and came up with this list:

fdftk.dll
fribidi.dll
gds32.dll
libeay32.dll
libmash.dll
libmysql.dll
libmysqli.dll *
msql.dll
ntwdblib.dll
php5apache2.dll
php5apache.dll
php5apache_hooks.dll
php5isapi.dll
php5nsapi.dll
php5ts.dll
php_msql.dll **
php_mssql.dll **
php_mysql.dll **
php_mysqli.dll **
ssleay32.dll
yas.dll

    • I don’t have this one
      ** - Should be found in the PHP “ext” directory. The page where I found this list didn’t have these names with the underscore. However all three computers I have set up with Apache2 and PHP5 have the files named the way they are listed here.

You may not need all of those right now since I’m not sure if you’re going to be using both MySQL and MSSQL or even some of those others. But you know what, it doesn’t hurt to put them in there now incase you want to use them later. Then you’re not looking around for them.

You should be able to find all those files in your PHP directory (c:\webphp) and the “ext” directory (c:\webphp\ext).

  1. Make sure that you set the PHP path for Windows. To do this…
  • Control Panel > System > Advanced tab
  • Click on “Environment variables”
  • Look in the “System variables” pane for the “Path” entry
  • Edit that to add on your path to where you installed PHP (mainly you’ll need to add on “;c:\webphp” – w/o the quotes.
  • Now restart the Apache server (you may even want to restart windows first)

NOTE: For my “Path” I noticed I also have the PHP “ext” directory listed. I’m not sure why but you may want/need to add that as well. Try it as listed above and if it doesn’t work then add to your path “;c:\webphp\ext” – again w/o the quotes.

Hi, I have checked & done all as requested, its still trying to download instead of loading…I installed from the below instructions & site:

Install Your Own PHP Server w/ Apache

http://www.kirupa.com/web/apache_php3.htm

I hope this is helpful…Thanks Rhonda

I noticed a few sites saying that people didn’t have the php5apache2.dll file included with the installer they downloaded. Make SURE that you have that file and that you put it into Apache “ServerRoot” directory. If you don’t have or are missing some of the files I previously told you that you may need to have, download the zip file of PHP and get those files. I think that’s what the problem is here. But I’m just guessing without being infront of your computer beign able to check everything.

BTW - If you put an HTML file in your DocumentRoot does it open that?

Here’s my setup and the parts of my httpd.conf file. Maybe it’ll help you… compare notes a bit and see if anything looks out of the ordinary.

ServerRoot "F:/Apache Group/Apache2"

ServerName localhost:80

UseCanonicalName Off

DocumentRoot "F:/www"

<Directory "F:/www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

ServerRoot should point to where you installed Apache2

ServerName - the instructions you followed had you do this, but check again to make sure

DocumentRoot is where the root of your host will be. In otherwords where you put all the files for your sever.

<Directory “F:/www”> … – make sure the path here is the same as your DocumentRoot. Don’t worry about what’s in between those tags, they should be the same since I don’t think I made any changes from the default installation.

Also in my hosts file (C:\windows\system32\drivers\etc\hosts) I had to manually put in:

127.0.0.1       localhost

So check to make sure that you have that in your hosts file as well.