httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Gaddy" <>
Subject CGI and PHP issue on Apache 2.0.35 for Win2kPro
Date Thu, 30 May 2002 15:24:40 GMT
First off, let me start by saying that I am relatively new to Apache, and
completely new to CGI, PHP, AND Perl... I have 4 servers running on a single
box, one of which is Apache.  Apache is running like a champ with several
virtual hosts, and great logging... I have had no issues whatsoever with
Apache, minus of course my ignorance at first in setting it up... Isn't that
always the case though... You can never truly blame Apache, (minus bugs),
for problems, its almost always operator related, which brings us to my
problem :)  I have recently been asked by THE BOSS to install CGI, PHP, and
Perl v5.6.1, as at first install, all we needed was just webpage hosting,
and needed nothing else... I have been researching all of these heavily, and
I believe I have CGI working fine, though it would not work until I renamed
the scripts that are under C:\Program Files\Apache Group\Apache2\cgi-bin\ to
have "nph-" in front of the script name.  I found this in a user forum and I
thought I would try it, and it brought up the script... Before doing so I
was getting tons of different errors.  One of those errors was:

	Server error!
Error message:
malformed header from script. Bad header=HTTP/1.0 200 OK: C:/Program
Files/Apache Group/Apache2/cgi-bin/bpforum.exe
If you think this is a server error, please contact the webmaster
	Error 500

This again went away as soon as the "php-" was put in front of the script
name under the cgi-bin directory... I still get errors on the .pl files, but
I believe that to be because I have yet to install perl, which I actually
dont know and have yet to find Perl to be NECESSARY for CGI or PHP to work
properly, because mod_perl is not implemented in my apache... First question
is: Apache doesn't say on the CGI info areas that you need to put the "nph-"
in front of the file name to make it work... Do I need to have this, or is
something else not configured right... Here are the changes I made to the
httpd.conf file to actually implement CGI:

First I had to edit and uncomment out the following line:

	ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"

Then I had to edit the following lines where I added the option "+ExecCGI":

	<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">
    		AllowOverride None
    		Options +ExecCGI
    		Order allow,deny
    		Allow from all

Then I uncommented and edited the following line:

	AddHandler cgi-script .cgi .pl .exe

This is all I did to try to make CGI work... As this was all I found told to
me within faq's and forums... I then put a script into the directory shown
above in script alias, typed in
and hit enter, and it worked... I therefore believe CGI to be working fine,
however if anything else should be done, please let me know...

Now for PHP... I found on the net a nice download for an application known
as PHP4 for Win32... I installed this application and did the exact steps
that are in the document for installing PHP in Apache... That document

	If you want to install PHP for Windows Apache (CGI version),
	install Apache (See Apache install guide) and the PHP EasyWindows
	installer. Then add the following lines to the
	Apache/conf/httpd.conf file:

		# Path to PHP.EXE directory -- change ScriptAlias to suit your config.
		ScriptAlias /php4/ "C:/inetpub/scripts/php/"
		Action application/x-httpd-php4 "/php4/php.exe"
		AddType application/x-httpd-php4 .php
		AddType application/x-httpd-php4 .php3

	Finally stop and restart Apache. To test, copy test.php to your
	document root and try http://localhost/test.php

	You might also want to set index.php and index.php3 as default files
	to display in a directory. Append to the DirectoryIndex entry:

	DirectoryIndex index.html default.htm index.php index.php3

I did each of these steps by editing my httpd.conf file so that it looks
like this:

	ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"

	ScriptAlias /php4/ "C:/inetpub/scripts/php/"
	Action application/x-httpd-php4 "/php4/php.exe"
	AddType application/x-httpd-php4 .php
	AddType application/x-httpd-php4 .php3

As you see, I added another scriptalias directive and did so below the
CGI-BIN, which is how I believe it should work.  I then did the next step of
adding index.php and index.php3 in the DirectoryIndex directive so apache
looks like this:

	DirectoryIndex index.html index.html.var index.htm default.htm index.php

I then stopped and started apache, and tried the test by putting test.php in
my document root, which I believe to be c:\webserver\webs because of the
entry in apache which looks like the following:

	#DocumentRoot: The directory out of which you will serve your
	# documents. By default, all requests are taken from this directory, but
	# symbolic links and aliases may be used to point to other locations.
	DocumentRoot "C:/webserver/webs"

If this is correct, than after putting test.php in the root of webs, and
opening a browser and typing in http://localhost/test.php and hitting enter,
I simply got a page not found error... That led me to believe that I didnt
even have it in the right place... Im not sure... But nonetheless, this is
all I have done as far as configuring php... Just installed it, added the
apache entries as above, and tried it... I also cant get it to work if I
type in, and I get the following

	Server error!
Error message:
C:/INETPUB/SCRIPTS/PHP/test.php is not executable; ensure interpreted
scripts have "#!" first line
If you think this is a server error, please contact the webmaster
	Error 500 </>
05/30/02 10:18:57
Apache/2.0.35 (Win32)

Now unless Perl is needed, I dont see why this test.php would not work, as
the documentation says it should... It is correct that when viewing the file
with notepad that it does NOT have the #! on the first line, but after
inserting it into the test.php file, and retrying, I still get another
error, which is:

	Server error!
Error message:
couldn't create child process: 22693: C:/INETPUB/SCRIPTS/PHP/test.php
If you think this is a server error, please contact the webmaster
	Error 500 </>
05/30/02 10:21:20
Apache/2.0.35 (Win32)

So something is not right, and I dont know what it is... These are the
things I need help on... So as earlier stated, no mod_perl, no mod_php or
any modules for that matter other than default have been loaded... I didnt
think it was necessary as documentation never asked for this... If anyone
could please help me figure out CGI, and PHP, and let me know what needs to
be done to each to fix the issues at hand, please do so... I am neck deep in
programming languages that I do not understand very well, which doesnt help
my situation out very much... As I said at the beginning, operator's errors
commonly cause these situations, so please, tell me how I screwed up  :)

Also, if anyone has a great link for a how-to type manual for installing and
configuring Perl v5.6.1 and all needed modules, I would love that...

Thanks again for any help that can be provided, and if you need any more
information, please feel free to ask...

Daniel Gaddy
Sparc Technologies

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message