Discussion:
[PHP-INSTALL] Behavior of PHP module vs. PHP cgi
Jesse Santana
2008-06-04 16:09:45 UTC
Permalink
Can someone explain to me why this script:

#!/usr/local/php5/bin/php

<html>
<head><title>PHP Test</title></head>
<body>
<p>If nothing follows this paragraph, PHP is not enabled.</p>
<?php phpinfo() ?>

</body>
</html>

Displays perfectly on a system with PHP installed and running as an Apache
module - see: http://eagles.its.csulb.edu/php/phptest.php.
Yet displays completely differently when run through PHP compiled as a CGI
- see: http://eagles.its.csulb.edu/~jsantana/phptest.php

I've noticed this behavior on all PHP versions since 5.2.3 came out.
Version 5.2.2 displays correctly when compiled as a CGI as shown here:
http://gaggle.its.csulb.edu/~jsantana/phptest.php

Thank you in advance,

Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA 90840
Office: (562)985-8511
Fax: (562)985-8855
Keith Roberts
2008-06-04 22:00:56 UTC
Permalink
Subject: [PHP-INSTALL] Behavior of PHP module vs. PHP cgi
#!/usr/local/php5/bin/php
You don't need this line for the apache module version of
php. This is a shell directive to run the CLI version of
PHP, which is not required by the apache PHP module.
<html>
<head><title>PHP Test</title></head>
<body>
<p>If nothing follows this paragraph, PHP is not enabled.</p>
<?php phpinfo() ?>
</body>
</html>
Displays perfectly on a system with PHP installed and
http://eagles.its.csulb.edu/php/phptest.php. Yet displays
completely differently when run through PHP compiled as a
http://eagles.its.csulb.edu/~jsantana/phptest.php
Looking at the output it seems like this is running the CLI
version of PHP. Not the apache module of PHP or the CGI
version.
I've noticed this behavior on all PHP versions since 5.2.3 came out.
http://gaggle.its.csulb.edu/~jsantana/phptest.php
This may be running the CGI version of PHP. So there appears
to be three different versions of PHP you are running here.

It may be that the default behavoir for running PHP as a CGI
script has been modified since PHP 5.2.2?

HTH

Regards,

Keith Roberts
Thank you in advance,
Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA 90840
Office: (562)985-8511
Fax: (562)985-8855
-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Jesse Santana
2008-06-04 22:18:32 UTC
Permalink
You don't need this line for the apache module version of
php. This is a shell directive to run the CLI version of
PHP, which is not required by the apache PHP module.

Understood. I just left that in to show that the script I am running is
exactly the same. We don't include this when running PHP scripts through
an Apache module.

Looking at the output it seems like this is running the CLI
version of PHP. Not the apache module of PHP or the CGI
version.

So how do I force the CGI version?

This may be running the CGI version of PHP. So there appears
to be three different versions of PHP you are running here.

I am running version 5.2.2 on gaggle. PHP is compiled as a CGI and
displays phpinfo() the same as when compiled as an Apache module.

Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA 90840
Office: (562)985-8511
Fax: (562)985-8855




From:
Keith Roberts <***@karsites.net>
To:
php-***@lists.php.net
Date:
06/04/2008 02:58 PM
Subject:
Re: [PHP-INSTALL] Behavior of PHP module vs. PHP cgi
Subject: [PHP-INSTALL] Behavior of PHP module vs. PHP cgi
#!/usr/local/php5/bin/php
You don't need this line for the apache module version of
php. This is a shell directive to run the CLI version of
PHP, which is not required by the apache PHP module.
<html>
<head><title>PHP Test</title></head>
<body>
<p>If nothing follows this paragraph, PHP is not enabled.</p>
<?php phpinfo() ?>
</body>
</html>
Displays perfectly on a system with PHP installed and
http://eagles.its.csulb.edu/php/phptest.php. Yet displays
completely differently when run through PHP compiled as a
http://eagles.its.csulb.edu/~jsantana/phptest.php
Looking at the output it seems like this is running the CLI
version of PHP. Not the apache module of PHP or the CGI
version.
I've noticed this behavior on all PHP versions since 5.2.3 came out.
http://gaggle.its.csulb.edu/~jsantana/phptest.php
This may be running the CGI version of PHP. So there appears
to be three different versions of PHP you are running here.

It may be that the default behavoir for running PHP as a CGI
script has been modified since PHP 5.2.2?

HTH

Regards,

Keith Roberts
Thank you in advance,
Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA 90840
Office: (562)985-8511
Fax: (562)985-8855
-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Loading...