Forum Moderators: coopster
Installed Apache (1.3.33) - all OK (relatively speaking).
Installed PHP4 - working from command line.
How do I get them talking?
The manual says that (amongst other things) I should put tis line in httpd.conf:
# Add to the end of the LoadModule section
LoadModule php4_module "c:/php/php4apache.dll"
..but the Windows installer doesn't come with php4apache.dll. So now what?
Do I find it? or do I try to uninstall PHP completely and do a manual install instead?
1. Put your PHP files in a directory called 'php'. You might already have done this. Copy php4ts.dll from the 'php' directory to the Windows System directory:
c:\winnt\system32 (for Windows 2000/NT4)
or c:\windows\system32 (for Windows XP)
or c:\windows\system (for Win9x/Me).
2. Copy php.ini-dist as php.ini from the 'php' directory to your Windows directory:
\windows (for 9x/Me/XP)
\winnt (for NT4/2000).
IMPORTANT! Note the name change.
3. Open httpd.conf in your 'apache\conf' directory. Make the following edits. At the end of the file, add the following, make sure directory names are correct:
LoadModule php4_module "c:/program files/php/sapi/php4apache.dll"Change line #385
From:
DirectoryIndex index.html
To:
DirectoryIndex index.html index.php index.php3 index.phtml index.shtml index.htm
Add the following line to end of the <ifmodule> section on line #849
#
# To use server-parsed PHP files
#
AddType application/x-httpd-php .php .php3 .php4 .phtml
Now apache can handle PHP file processing. Restart Apache for the changes to take effect.
4. Create a file "test.php" and place it in the 'apache/htdocs' directory. Place the single line in it:
<?php phpinfo();?>
Then open the page: [localhost...]
You should see all the information about your PHP setup and Apache configuration as well as other useful information. If you do, all is working ok.
If you want to create anything, then it needs to be in the 'httdocs' folder.
Good luck!
dc
Thing is, I have already succeeded in getting that far - but down a slightly different path.
This page [php.net] in the manual states 2 ways of configuring PHP with Apache
#1. Installing as an Apache module
#2. Installing as a CGI binary
I would have preferred #1, which is where your post is pointing, I believe. However, I installed PHP using the Windows installer package, which isn't "preferred", it turns out.
Since my last post, I attempted the instructions for #2. Everything is now working fine, as far as I can tell.
Here's my problem. There are a couple of things (at least) that I'd like to do soonish:
1. Install MySQL
2. Configure PHP for ActiveScripting (not so important, but could be entertaining)
Looking ahead in the manual, every time some further configuration is mentioned, it first says "read the manual installation notes", then it goes on to mention files, and directory structures that plainly are not present in my meagre installation.
Rather than mention what I don't have, I'll list my entire installation:
[blue]C:\Program\PHP\BACKUP
C:\Program\PHP\IISConfig.exe
C:\Program\PHP\install.txt
C:\Program\PHP\License
C:\Program\PHP\php.exe
C:\Program\PHP\php4ts.dll
C:\Program\PHP\sessiondata
C:\Program\PHP\test.php
C:\Program\PHP\uploadtemp
C:\Program\PHP\BACKUP\UNWISE.EXE
+ 2 empty directories
[/blue]
(note: no php4apache.dll or php.ini-dist, so I can't follow your instructions.)
Quandary:
I get the impression from the manual that my "as a CGI Binary" is the "poor man's choice", and that "Apache Module" is just better all round.
Do I just get on with learning PHP for a while, or do I, in the hope that it will make things somehow easier in the long run, clear out the whole installation, and do it all again as a "manual installation" - at risk of messing up and pushing this thread over 10 foot?
I recently upgraded to 4.3.10, and installed it manually. No need to move the dll into the windows dir; just add the PHP dir to the PATH (in autoexec.bat). Makes it easier to upgrade to a next version (no dll clutter).
You'll need the full package whenever you need one of the extensions it includes, such as GD, CURL, ZIP, XML-RPC, and many others.
Yet, I think I'll leave this for a week or so, and simply get into the language itself, since things seem to be working for the time being.
Thanks.