Can't yet display a simple PHP-style HTML file
| From: | Robert Boeninger | Date: | Mon, 08 Nov 1999 03:55:42 +0000 |
| Subject: | Can't yet display a simple PHP-style HTML file | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-5949@lists.php.net to get a copy of this message | ||
Nov 7, 1999
Hello everbody,
Here is a simple question from a new user of PHP:
I can't get a simple HTML + PHP page to show the PHP portion.
Here is the complete HTML code:
-------------------
<html>
<body>
<?php $myvar = "Hello Earth\n"; echo $myvar; ?>
</body>
</html>
-------------------
When I display it, the page is completely blank, instead of showing
the expected "Hello Earth" text.
Certainly I confirmed that non-PHP text gets displayed fine.
As I said, I'm just beginning, having just installed PHP for the
first time (PHP4.0-b2) on a Sun Solaris 2.6 machine, with the
NS Enterprise 4.0 web server. As you may know, php runs as a cgi pgm,
not a module, when used with the NS web server.
The only little test that has worked for me is running the above file,
call it 'test.php' with the command-line php program, thusly:
php -f test.php.
That successfully shows the final HTML code. This makes me believe
that my php executable at least works.
I tried to follow various overlapping instructions for configuring
the NS Enterprise web server to redirect php tags to the php program
for preprocessing. And yes, I did restart the NS web server after
diddling with the /config files.
---------------
The things I did to try to get the web server to redirect php tags were:
compile 'redirect-cgi.c' with the included Makefile, putting the
resulting 'redirect_cgi.so' file in directory '/opt/php'.
Changed before compiling: in file cgi_main.c (not main.c, as suggested in
the PHP website tips) line:
if (!getenv("REDIRECT_STATUS")) {
to line:
if (!getenv("HTTP_REDIRECT_STATUS")) {
in my non-admin webserver directory's 'config' subdir, I made the
following changes to the following files:
magnus.conf: added following line to the end:
Init fn=load-modules shlib=/opt/php/redirect_cgi.so funcs=redirect-cgi
obj.conf: immediately after line:
ObjectType fn=type-by-extension
I added line:
ObjectType fn="redirect-cgi" cgi_path="/opt/php/bin/php"
type="magnus-internal/php"
mime.conf: Added following line to end of file:
type=magnus-internal/php exts=php,phtml
-------------
I changed nothing in the (renamed) php.ini, except move it to directory
/opt/php, where I had 'configured' it to be located.
Or is this 'php.ini' file supposed to be doctored up by hand?
By the way, I ran 'configure' as follows:
./configure --enable-discard-path
--with-gd=no
--with-gettext=no
--with-oracle=/usr/oracle
--enable-short-tags=no
--bindir=/opt/php/bin
--with-config-file-path=/opt/php
--enable-bcmath
--enable-force-cgi-redirect=yes
--enable-discard-path=yes
-----------------------
I guess this is a lot to slosh through. My main hope would be that
someone out there would know perhaps what the most common cause of
my problem might be and clue me in.