You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Daniel Gaddy <dg...@sparctech.com> on 2002/05/30 17:24:40 UTC

CGI and PHP issue on Apache 2.0.35 for Win2kPro

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
<ma...@technalithics.com>
	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
	</Directory>

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 www.sparctech.com/cgi-bin/nph-bpforum.exe
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
reads:

	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
index.php3

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 http://www.sparctech.com/php4/test.php, and I get the following
error:

	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
<ma...@technalithics.com>
	Error 500
www.sparctech.com </>
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
<ma...@technalithics.com>
	Error 500
www.sparctech.com </>
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: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_php for Win2kPro on Apache 2.0.35

Posted by Robert Andersson <ro...@profundis.nu>.
I'm not very experienced here, but i'll try to help you through your
problems, as I caused them ;-)

Daniel Gaddy wrote,

> I got this PHP zip package, and extracted all files to c:\php_4.2.1  Then
I
> copied php4ts.dll and php.ini to the c:\winnt\system32\ folder.  Then I
> edited the php.ini file so that paths were correct... I then in the
> httpd.conf file for apache, inserted the three lines you said to insert,
> which were:
>
> > LoadModule php4_module "G:/usr/local/php4/sapi/php4apache2.dll"
> > AddType application/x-httpd-php .php .phtml
> > AddType application/x-httpd-php-source .phps
>
> I added the two ADDTYPE entries under the one AddType application
directive
> that comes in httpd.conf by default.  I assume this is where I should have
> put them rather than beneath the actual LoadModule statement, as other
> LoadModule statements were below.  And I then saved and restarted the web
> server, and it would not start... The error message was: The requested
> operation has failed.  My logs offered no help at all...

How did you restart the server, and where did this error message pop up, and
do you run Apache as a service?
Perhaps you said so in an earlier letter, but which os/version are you doing
this on?
And, does it start and work if you only uncomment the LoadModule-directive?
There are both a "php4apache.dll" and a "php4apache2.dll". You are sure
you're using the latter?
You must also use forward slashes / in all path names in httpd.conf.

> So something is
> wrong... Are you sure I am suppose to use the quotes around the drive and
> path for the module, and are you sure the .dll will work rather than the
> .so, which apache mainly uses for modules...

Pretty sure; it works for me, and you're encouraged to do so in the manual.
For the .dll, modules can be either compiled in, loadable modules (.so) or
dlls. The PHP extension is in form of a dll.

> I appologize if I have
> forgotten to do something, but in following your steps, I was unable to
get
> it to work properly...
>
> I would appreciate whatever help you could offer

We shall try to sort this out. If it don't magically start to function, do
send/attache your httpd.conf and php.ini (you can cut out irrelevant stuff
if you want) and will look at them to see if I have missed to point out
something obvious. The problem here is that I really don't know what one
needs to do to get this working. I was lucky, reading some posts in this
forum about Win32+Apache2+PHP4 and the install notes, and it just worked the
first time, but hopefully we reach that point for you too :-)

Regards,
Robert Andersson




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


Re: Mod_php for Win2kPro on Apache 2.0.35

Posted by Daniel Gaddy <dg...@sparctech.com>.
I got this PHP zip package, and extracted all files to c:\php_4.2.1  Then I
copied php4ts.dll and php.ini to the c:\winnt\system32\ folder.  Then I
edited the php.ini file so that paths were correct... I then in the
httpd.conf file for apache, inserted the three lines you said to insert,
which were:

> LoadModule php4_module "G:/usr/local/php4/sapi/php4apache2.dll"
> AddType application/x-httpd-php .php .phtml
> AddType application/x-httpd-php-source .phps

I added the two ADDTYPE entries under the one AddType application directive
that comes in httpd.conf by default.  I assume this is where I should have
put them rather than beneath the actual LoadModule statement, as other
LoadModule statements were below.  And I then saved and restarted the web
server, and it would not start... The error message was: The requested
operation has failed.  My logs offered no help at all... So something is
wrong... Are you sure I am suppose to use the quotes around the drive and
path for the module, and are you sure the .dll will work rather than the
.so, which apache mainly uses for modules... I appologize if I have
forgotten to do something, but in following your steps, I was unable to get
it to work properly...

I would appreciate whatever help you could offer

Thanks...

----- Original Message -----
From: "Robert Andersson" <ro...@profundis.nu>
To: <us...@httpd.apache.org>; "Daniel Gaddy" <dg...@sparctech.com>
Sent: Thursday, June 06, 2002 12:36 PM
Subject: Re: Mod_php for Win2kPro on Apache 2.0.35


>
> Daniel Gaddy wrote,
>
> > Where do I get mod_php from and the instructions on how to implement it
> into
> > apache... Because your right, I WOULD rather have mod_php so that it
would
> > stay active within apache rather than opening up a new process EVERY
time
> > php is accessed on the server... That will quickly bog down my box...
Can
> > you assist me with this...
>
> Lets see...
>
> 1. First download the binaries from here: http://www.php.net/downloads.php
> Select the first one ("PHP 4.2.1 zip package") which includes the
extension.
>
> 2. Unpack the archive to a good place. You won't install (copy) this, so
> it'll be where you put it now forever :-)
> I put mine besides apache at G:/usr/local/php4/ (being somewhat unix
> compatible)
>
> 3. You should then open up install.txt (for example:
> G:/usr/local/php4/install.txt), and goto the section: "Windows Manual
> install from zip binary distribution". Read the stuff so you're in on it,
> but I comment some important steps.
> - I'm not sure this is necessary, but you should copy the php4ts.dll to
> %SYSTEMROOT%\system32 (if you're on NT)
> - Copy the php.ini-dist to %SYSTEMROOT% and remove the '-dist'-part.
> - Just follow the instructions when configuring the php.ini-file. You
don't
> need to change much but paths etc.
>
> 4. Skip down to the section "Web server configuration", and "Installing
PHP
> on Windows with Apache 1.3.x" (I know the version, but most stuff will
work
> anyway).
> - Instead of modifying httpd.conf the way they say, add these lines:
>
> LoadModule php4_module "G:/usr/local/php4/sapi/php4apache2.dll"
> AddType application/x-httpd-php .php .phtml
> AddType application/x-httpd-php-source .phps
>
> You should, of course, change the path to the dll to what you have. A tip
is
> to also add index.php etc. to the DirectoryIndex directiv
>
> 5. I hope i remembered most steps. Hopefully you restart the server and
> everything works great. Try searching the archives here, as there were
some
> discussions about php4+Apache2 a while ago. Let me know if you run into a
> rock.
>
> Regards,
> Robert Andersson
>
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Mod_php for Win2kPro on Apache 2.0.35

Posted by Prachait Saxena <su...@sitesontesting.com>.
Hello Robert Andersson

I had done as it is as you wrote. and PHP Module
But when restarting the apache I am getting the error as 
<31> A device attached to the system is not functioning

and same error when loading the SSL Module

Ya I have one TVTuner card on my machine which is not working. I removed 
it but still the same error. Any idea ???

My Machine Conf.
Win98 + Apache 1.3.24 + No NetworkCard

Please help me.

Bye and Have a nice day 

Prachait Saxena

WebMaster
SitesOnTesting.Com

If you do for other's !
Other's will do for you !!

Visit me at http://www.sitesontesting.com/prachait


-----Original Message-----
From: "Robert Andersson" <ro...@profundis.nu>
To: <us...@httpd.apache.org>, "Daniel Gaddy" <dg...@sparctech.com>
Date: Thu, 6 Jun 2002 19:36:51 +0200
Subject: Re: Mod_php for Win2kPro on Apache 2.0.35

> 
> Daniel Gaddy wrote,
> 
> > Where do I get mod_php from and the instructions on how to implement
> it
> into
> > apache... Because your right, I WOULD rather have mod_php so that it
> would
> > stay active within apache rather than opening up a new process EVERY
> time
> > php is accessed on the server... That will quickly bog down my box...
> Can
> > you assist me with this...
> 
> Lets see...
> 
> 1. First download the binaries from here:
> http://www.php.net/downloads.php
> Select the first one ("PHP 4.2.1 zip package") which includes the
> extension.
> 
> 2. Unpack the archive to a good place. You won't install (copy) this,
> so
> it'll be where you put it now forever :-)
> I put mine besides apache at G:/usr/local/php4/ (being somewhat unix
> compatible)
> 
> 3. You should then open up install.txt (for example:
> G:/usr/local/php4/install.txt), and goto the section: "Windows Manual
> install from zip binary distribution". Read the stuff so you're in on
> it,
> but I comment some important steps.
> - I'm not sure this is necessary, but you should copy the php4ts.dll to
> %SYSTEMROOT%\system32 (if you're on NT)
> - Copy the php.ini-dist to %SYSTEMROOT% and remove the '-dist'-part.
> - Just follow the instructions when configuring the php.ini-file. You
> don't
> need to change much but paths etc.
> 
> 4. Skip down to the section "Web server configuration", and "Installing
> PHP
> on Windows with Apache 1.3.x" (I know the version, but most stuff will
> work
> anyway).
> - Instead of modifying httpd.conf the way they say, add these lines:
> 
> LoadModule php4_module "G:/usr/local/php4/sapi/php4apache2.dll"
> AddType application/x-httpd-php .php .phtml
> AddType application/x-httpd-php-source .phps
> 
> You should, of course, change the path to the dll to what you have. A
> tip is
> to also add index.php etc. to the DirectoryIndex directiv
> 
> 5. I hope i remembered most steps. Hopefully you restart the server and
> everything works great. Try searching the archives here, as there were
> some
> discussions about php4+Apache2 a while ago. Let me know if you run into
> a
> rock.
> 
> Regards,
> Robert Andersson



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


Re: Mod_php for Win2kPro on Apache 2.0.35

Posted by Robert Andersson <ro...@profundis.nu>.
Daniel Gaddy wrote,

> Where do I get mod_php from and the instructions on how to implement it
into
> apache... Because your right, I WOULD rather have mod_php so that it would
> stay active within apache rather than opening up a new process EVERY time
> php is accessed on the server... That will quickly bog down my box... Can
> you assist me with this...

Lets see...

1. First download the binaries from here: http://www.php.net/downloads.php
Select the first one ("PHP 4.2.1 zip package") which includes the extension.

2. Unpack the archive to a good place. You won't install (copy) this, so
it'll be where you put it now forever :-)
I put mine besides apache at G:/usr/local/php4/ (being somewhat unix
compatible)

3. You should then open up install.txt (for example:
G:/usr/local/php4/install.txt), and goto the section: "Windows Manual
install from zip binary distribution". Read the stuff so you're in on it,
but I comment some important steps.
- I'm not sure this is necessary, but you should copy the php4ts.dll to
%SYSTEMROOT%\system32 (if you're on NT)
- Copy the php.ini-dist to %SYSTEMROOT% and remove the '-dist'-part.
- Just follow the instructions when configuring the php.ini-file. You don't
need to change much but paths etc.

4. Skip down to the section "Web server configuration", and "Installing PHP
on Windows with Apache 1.3.x" (I know the version, but most stuff will work
anyway).
- Instead of modifying httpd.conf the way they say, add these lines:

LoadModule php4_module "G:/usr/local/php4/sapi/php4apache2.dll"
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

You should, of course, change the path to the dll to what you have. A tip is
to also add index.php etc. to the DirectoryIndex directiv

5. I hope i remembered most steps. Hopefully you restart the server and
everything works great. Try searching the archives here, as there were some
discussions about php4+Apache2 a while ago. Let me know if you run into a
rock.

Regards,
Robert Andersson





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


Mod_php for Win2kPro on Apache 2.0.35

Posted by Daniel Gaddy <dg...@sparctech.com>.
Where do I get mod_php from and the instructions on how to implement it into
apache... Because your right, I WOULD rather have mod_php so that it would
stay active within apache rather than opening up a new process EVERY time
php is accessed on the server... That will quickly bog down my box... Can
you assist me with this...

Thanks,
----- Original Message -----
From: "Robert Andersson" <ro...@profundis.nu>
To: <us...@httpd.apache.org>; <dg...@sparctech.com>
Sent: Thursday, June 06, 2002 4:57 AM
Subject: Re: CGI and PHP issue on Apache 2.0.35 for Win2kPro


>
> Daniel Gaddy wrote,
>
> > 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
> > reads:
> >
> > 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:
>
> This is a guess, but I think you rather want to install the extension of
PHP
> above the CGI-version. Without any specific experience about modules etc,
> and none about PHP, I installed PHP 4.2.1 for Windows XP on Apache 2.0.36
> _very_ easy; just followed the instructions. So, if it isn't so that you
> must have the CGI-version, I would recommend you to use the extension
module
> instead, as it is much better/faster.
>
> > 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...
>
> As I understood it, you had already got Perl working fine, and you do not
> need it in any special way for PHP, so have it like it is (or was, if you
> made changes).
>
> Regards,
> Robert Andersson
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: CGI and PHP issue on Apache 2.0.35 for Win2kPro

Posted by Robert Andersson <ro...@profundis.nu>.
Daniel Gaddy wrote,

> 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
> reads:
>
> 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:

This is a guess, but I think you rather want to install the extension of PHP
above the CGI-version. Without any specific experience about modules etc,
and none about PHP, I installed PHP 4.2.1 for Windows XP on Apache 2.0.36
_very_ easy; just followed the instructions. So, if it isn't so that you
must have the CGI-version, I would recommend you to use the extension module
instead, as it is much better/faster.

> 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...

As I understood it, you had already got Perl working fine, and you do not
need it in any special way for PHP, so have it like it is (or was, if you
made changes).

Regards,
Robert Andersson




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