PHP Newbie question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi all I just got this book "SAMS Teach Yourself PHP, MySQL, and
Apache" 1st Edition.

I am follwing the instructions on Appendix A for setting up MySQL,
Apache, and PHP in that order.

After installing the first two, I can bring up the default web page for
Apache.  So this works.

After installing PHP and making the changes it suggested. I cannot open
the page anymore.  The instructions says to create an index.php file in
the "htdocs" folder.  I tried to call it from the browser and it
returns with a windows asking me if I want to save or run.

I've done this twice on a W2K3 and now on W2K with the same result!


Re: PHP Newbie question

If the server is treating PHP files as downloadable files rather than
executable files, then you need to add something to the web server to
instruct Apache to use the php executable to run the php files, instead
of sending them for download.  It's like a zip file, since the server
doesn't know what it is, it just sends it off for download, but you can
always add something to the server that gives it special instructions
for the .zip and it will treat it differently.

The question is how do you set up Apache to use php to handle requests
for .php pages, and I'm not familiar with the setup of Apache, so
someone else will have to answer that one.

Re: PHP Newbie question

Quoted text here. Click to load it

I have an edition of that book which I tried to use, circa 2003.
The instructions  don't match the new versions of software,
the names and locations of files. So I downloaded the new
versions, found instructions of the web for Windowx XP pro.
I will include them since you don't mention your OS. I had to
do a system restore because I corrupted the configuration install
file with my various attempts. Redhat linux has the rpm erase.

I got this problem fixed. I used the msi installer for Apache
instead of the full download, I have Windows XP pro.
I also uninstalled IIs because I wasn't ready to deal with
manual start on port 8080, so I didn't choose developer.
Also added c:\PHP to my Path statement. So this worked
with PHP5.04 ; MySQL 5.0 beta ; and Apache 2.0.54
Later I reinstalled IIs to port 80. I set Apache, httpd.conf
to Listen 8080 and ServerName localhost:8080 which
allows both to work. I haven't gotten to making PHP work
with IIS, it requires cgi I think. This tutorial is good!
I used the automatic startup of the Apache service install choice.
Also I typed in the tutorial testing files by hand to learn syntax. Windows/

LoadModule php5_module php5apache2.dll
AddType application/x-httpd-php .php

1. Make sure that you have a valid php.ini in your windows directory.
OR (Per the tut the 'php.ini' can be installed in the
'C:\Program Files\Apache Group\Apache2' folder. This works fine.)
2. copy libmysql.dll to the system32 directory
(php_mysql.dll would not load without doing this)
3. set the extension_dir in php.ini to the ext directory of your PHP
installation directory (like e.g. extension_dir=C:\php5\ext)
4. enable the MySQL extension in php.ini by uncommenting the line
5. Restart Apache Server

I think that installation web  tutorial is well written.
Don't forget to restart your apache server and refresh
the browser; getting the syntax right calls for attention.
Another research and help resource:


Re: PHP Newbie question

I followed the website referred by Stephen.  Thanks for the tip.  That
worked perfectly.  I then went back to the original installation from
the book and made the following changes...

Edit php.ini
doc_root = C:\Program Files\Apache Group\Apache2\htdocs

Copy 3 files to C:\Program Files\Apache Group\Apache2

Edit httpd.conf
LoadModule php4_module php4apache2.dll

My original problem, I believe, was Apache not being able to find the
EXE, as Steve stated.

In the book it instructs to copy the 3 files above to winnt\system32.
When I copied it over to the Apache location and called the index.php
file.  It worked!!!!

Thanks guys for your help.....

Site Timeline