httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pete Nelson" <pete.nel...@ci.stpaul.mn.us>
Subject Re: Getting Apache running locally for test purposes
Date Tue, 14 May 2002 13:43:47 GMT
There are basically two ways to run PHP - as an outside program that
runs every time a php-request is made (CGI), or as a module that loads
with Apache at startup and handles requests.  The configuration options
are a little different, and that may be one point of confusion.

It looks like you're trying to use it as a CGI, which is fine for
testing php (the module offers faster performance, and is usually the
choice for a production environment).  Basically what you need to tell
Apache is 1) where the php executable is and 2) what type of files
should be run through the php executable.

The ScriptAlias (as you've done in your example) sets up two things -
it aliases the directory containg php into your server's path, and tells
Apache to 'execute' any requests in that directory:

  ScriptAlias /php/ "C:/My Programs/PHP/"

Now, you must let Apache know that .php files should be treated special
by setting a special MIME-type:

  AddType application/x-httpd-php .php .php3 .php4 .phtml

(Note that you can add as many file extensions as you wish)

Finally, tell Apache how to handle these special files:

  Action application/x-httpd-php /php/php.exe

At this point, (re)start Apache and test.  If you're still having
trouble, I would do the following to test:
  
 - open a command prompt in the php directory.  Copy your phpinfo.php
file into that directory and test with "php -f phpinfo.php".  You should
either see a lot of HTML code scroll by (success) or a bunch of errors. 
This will tell you if php is working or not.

 - if you think the problem might be Norton, try turning it off to
test.

 - if possible, use a browser other than IE.  Especially for testing,
I've found that IE often pulls files from it's cache (even when it
shouldn't).  I've had problems that I've actually fixed but didn't know
it because IE was pulling an old error document from it's cache rather
than pulling the page from the server.

--
Pete Nelson, Web Developer
<pete.nelson@ci.stpaul.mn.us>
http://www.ci.stpaul.mn.us/

>>> adriangreeman@pixandwords.freeserve.co.uk 05/14/02 04:11AM >>>
Excuse a newby asking what might be a stupid question.

I am trying to learn PHP and to do so need a local server so
I have downloaded Apache (1.3.24). and PHP 4.2.0 Win32.    I use
Windows ME on a standalone PC and will run the server just to
test my PHP knowledge and hopefully eventually develop a website using
MySQL.

Guidance for getting this running seems to vary but I have gone with
stuff in a couple of places - the book  "MySQL/PHP Databases" and an
article from thesitewizard.com

They more or less agree on what you have to write into the Apache
configuration file to get it going and recognising PHP (recognising
.php extensions, and entering
ScriptAlias   /php/  "C:/My Programs/PHP/")

I have done this and I have written "phpinfo" function in a test php
file.

Right. So it should work.

The Apache server Starts from Windows Start, and I checked the syntax
in the file which is correct
It says it's running - took a while to get that  - and after some
messing the IE6 browser seems to find it, when I am requesting the
recommended phpinfo.php file.

I use http://localhost/phpinfo.php 

But all I get is a big "forbidden".

I am not allowed access to the file phpinfo.php  (or misspellings of
it I also found out).

FAQs says for this problem check the Apache httpd.conf file looking
for <Files~>
but zilch there.

I am slightly daunted by the deep water of the users discussions and
manuals but have battled with them to some extent.  May I ask if
anyone on this list can suggest what I have done wrong - or point me
at previous discussions or the right manual pages??

Possibly useful information :

1. I am uncertain about where the php.ini file should go -
in the article and the book and the
PHP site information the recommentdations seem to vary.

Suggestions are in:

same directory as php.exe
or Windows
or Windows\System
or Windows\System32

I tried each and currently it is in Windows


One other piece of information is that I have Norton Anti-Virus on the
computer and it did try messing with the settings in the config file -
could that be the reason?  eg it set the e-mail to admin@norton
['scuse that's not the full name]

and the server name to Norton Antivirus

- though I have changed that to 127.0.0.1


Please suggest what else I should try to do.   Or should I start over?



Regards from
    Adrian Greeman

52 Salterford Road, Tooting, London, SW17 9TF

Phone  +44 (0)20 8672 9661
Mobile  +44 (0)780 329 7447

Fax:  I can receive these
on the computer
but only when present
- please phone first



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message