By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,747 Members | 1,671 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,747 IT Pros & Developers. It's quick & easy.

Install oddity Win2K/Apache2/PHP4

P: n/a
PHP Newbie question: I installed the above, and if I point directly to a
..php file (i.e. http://localhost/phpinfo.php, I get the php script executed
properly. If I put a <?php ... ?> tag in html, nothing happens. No error
in any Apache logs, no obvious errors in php, nothing displayed on the
page.

I installed as cgi, I saw an earlier post someone recommended SAPI - could
that be a problem (I'm guessing it's some line in one of the configs I
screwed up).

Thanks,
-G
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Wed, 29 Oct 2003 14:15:53 +0000, Greg Bryant wrote:
PHP Newbie question: I installed the above, and if I point directly to a
.php file (i.e. http://localhost/phpinfo.php, I get the php script executed
properly. If I put a <?php ... ?> tag in html, nothing happens. No error
in any Apache logs, no obvious errors in php, nothing displayed on the
page.

I installed as cgi, I saw an earlier post someone recommended SAPI - could
that be a problem (I'm guessing it's some line in one of the configs I
screwed up).

Thanks,
-G

If installed as a CGI, I think the scripts need to be coded like Perl
scripts and use a Shebang line:
#!/usr/bin/php
[ ... rest of script ... ]
rather than the "usual" <?php ... ?> tag method. Your path to your PHP
binary may differ to the above naturally =)

My recommendation would be to reinstall as a module rather than CGI as
this is both faster and more secure.
HTH =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #2

P: n/a
Greg Bryant wrote:
PHP Newbie question: I installed the above, and if I point directly to a
.php file (i.e. http://localhost/phpinfo.php, I get the php script executed
properly. If I put a <?php ... ?> tag in html, nothing happens. No error
in any Apache logs, no obvious errors in php, nothing displayed on the
page.

I installed as cgi, I saw an earlier post someone recommended SAPI - could
that be a problem (I'm guessing it's some line in one of the configs I
screwed up).

Thanks,
-G


Well ... I never used PHP as a cgi, but with php as a module and apache
not configured to call php for xxx.html pages the php code is send
"as-is" to the browser. Check the page source and you'll see the source
there. My guess is your browser is hiding the <?php ... ?> tags the same
way it hides <b>, <a title="xxx">, etc.
--
I have a spam filter working.
To mail me include "urkxvq" (with or without the quotes)
in the subject line, or your mail will be ruthlessly discarded.
Jul 17 '05 #3

P: n/a
Pedro <he****@hotpop.com> wrote in message news:<bn*************@ID-203069.news.uni-berlin.de>...
Greg Bryant wrote:
PHP Newbie question: I installed the above, and if I point directly to a
.php file (i.e. http://localhost/phpinfo.php, I get the php script executed
properly. If I put a <?php ... ?> tag in html, nothing happens. No error
in any Apache logs, no obvious errors in php, nothing displayed on the
page.

I installed as cgi, I saw an earlier post someone recommended SAPI - could
that be a problem (I'm guessing it's some line in one of the configs I
screwed up).

Thanks,
-G


Well ... I never used PHP as a cgi, but with php as a module and apache
not configured to call php for xxx.html pages the php code is send
"as-is" to the browser. Check the page source and you'll see the source
there. My guess is your browser is hiding the <?php ... ?> tags the same
way it hides <b>, <a title="xxx">, etc.


It is noted in the PHP documentation that PHP is not supported in
Apache2 except at highly experimental levels. You might be having
other issues as well, but to be sure I would downgrade your Apache
version to 1.3.28.

It is also noted in the PHP docs that running PHP as a CGI from Apache
is not all that good of an idea unless you really know what you are
doing.

To run PHP as an Apache Module in 1.3.28, configure your php.ini file
with the needed info and then copy php.ini and php4ts.dll to the
Apache server root. Then add the following lines to your httpd.conf
file in the appropriate sections:

LoadModule php4_module c:/php4win/sapi/php4apache.dll

AddModule mod_php4.c

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Jul 17 '05 #4

P: n/a
Pedro <he****@hotpop.com> wrote in message news:<bn*************@ID-203069.news.uni-berlin.de>...
Greg Bryant wrote:
PHP Newbie question: I installed the above, and if I point directly to a
.php file (i.e. http://localhost/phpinfo.php, I get the php script executed
properly. If I put a <?php ... ?> tag in html, nothing happens. No error
in any Apache logs, no obvious errors in php, nothing displayed on the
page.

I installed as cgi, I saw an earlier post someone recommended SAPI - could
that be a problem (I'm guessing it's some line in one of the configs I
screwed up).

Thanks,
-G


Well ... I never used PHP as a cgi, but with php as a module and apache
not configured to call php for xxx.html pages the php code is send
"as-is" to the browser. Check the page source and you'll see the source
there. My guess is your browser is hiding the <?php ... ?> tags the same
way it hides <b>, <a title="xxx">, etc.


Another thing about embedding php in a doc with a .html extension...
it won't work. You need to rename the file with a .php extension in
order for the server to proerly parse the info.
Jul 17 '05 #5

P: n/a
On Wed, 29 Oct 2003 19:00:52 -0800, zdope wrote:
Another thing about embedding php in a doc with a .html extension... it
won't work. You need to rename the file with a .php extension in order for
the server to proerly parse the info.

That's completely wrong!

You configure what extensions you want to parse as PHP files when you
install / config it all, there's _nothing_ to stop you using .html files
for PHP execution, although personally, I wouldn't recommend it.

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #6

P: n/a
zd******@hotmail.com (zdope) wrote in message news:<b6**************************@posting.google. com>...
Pedro <he****@hotpop.com> wrote in message news:<bn*************@ID-203069.news.uni-berlin.de>...

Another thing about embedding php in a doc with a .html extension...
it won't work. You need to rename the file with a .php extension in
order for the server to proerly parse the info.
CORRECTION:
"gf" <gf******@earthlink.net> wrote in message news:<iJ****************@newsread4.news.pas.earthl ink.net>...
In your apache httpd.conf file, make sure you have this line (or similar) to
parse your php code in your .htm* documents. That will resolve your issue.

AddType application/x-httpd-php .phtml .php .php3 .htm .html

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.