Getting PHP to work

Darin Perusich Darin.Perusich at cognigencorp.com
Mon Aug 4 12:20:58 EDT 2003


are you running php as a module or built into apache? if you're running 
as a module apache needs to be compile with mod_so enabled, check this 
by running httpd -l and look for mod_so. if php is built as part of 
apache httpd -l will have mod_php4.c listed as well. apache also needs 
to know how to interpret php script from plain html. there should be a 
line in httpd.conf that reads at least "AddType application/x-httpd-php 
.php", this will only read .php pages though. using "AddType 
application/x-httpd-php .php .php3 .htm .html" will allow php to render 
all files ending with these extensions.

i'd also recommend setting the DirectoryIndex directive to 
"DirectoryIndex index.html index.htm login.html login.htm index.phtml 
index.php index.php3". this way if you use index.php instead of 
index.html that page will load by default.

also the line you entered into mozilla's location will cause mozilla to 
read the file as if it where a text file, you've bypassed the webserver. 
doing something like http://localhost/~bigbird/pgm/phpinfo.php would be 
more approiate.

Asheville Joe wrote:
> I'm trying to check out PHP.  I wrote the following file and named it 
> /home/bigbird/pgm/phpinfo.php
> 
> <? phpinfo(); ?>
> 
> I start Mozilla and enter file:///home/bigbird/pgm/phpinfo.php in the 
> address field and it displays the file as plain text (i.e. php is not 
> invoked).
> 
> I did a urpmi on php and it says all installed then
> 
> [root at localhost doc]# php -v
> PHP 4.3.1 (cli) (built: Feb 17 2003 14:34:15)
> Copyright (c) 1997-2002 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
> 
> shows that it's there.
> 
> ps -ae shows
> 
>  PID TTY          TIME CMD
>    1 ?        00:00:04 init
>    2 ?        00:00:00 keventd
>    3 ?       ` 00:00:00 kapmd
>    4 ?        00:00:00 ksoftirqd_CPU0
>    5 ?        00:00:01 kswapd
>    6 ?        00:00:00 bdflush
>    7 ?        00:00:00 kupdated
>    8 ?        00:00:00 mdrecoveryd
>   12 ?        00:00:00 kjournald
>  123 ?        00:00:01 devfsd
>  218 ?        00:00:00 khubd
>  538 ?        00:00:00 kjournald
>  925 ?        00:00:00 portmap
>  941 ?        00:00:00 syslogd
>  949 ?        00:00:00 klogd
>  997 ?        00:00:00 rpc.statd
> 1014 ?        00:00:00 gpm
> 1127 ?        00:00:00 xfs
> 1169 ?        00:00:00 apmd
> 1202 ?        00:00:00 mdkkdm
> 1220 ?        00:01:22 X
> 1221 ?        00:00:00 atd
> 1235 ?        00:00:00 mdkkdm
> 1247 ?        00:00:00 saslauthd
> 1256 ?        00:00:00 saslauthd
> 1257 ?        00:00:00 saslauthd
> 1258 ?        00:00:00 saslauthd
> 1259 ?        00:00:00 saslauthd
> 1270 ?        00:00:06 python
> 1290 ?        00:00:00 tmdns
> 1319 ?        00:00:00 xinetd
> 1378 ?        00:00:00 cupsd
> 1406 ?        00:00:02 fam
> 1613 ?        00:00:00 master
> 1627 ?        00:00:00 pickup
> 1628 ?        00:00:00 nqmgr
> 1878 ?        00:00:00 httpd-perl
> 1885 ?        00:00:00 httpd-perl
> 1886 ?        00:00:00 httpd-perl
> 1887 ?        00:00:00 httpd-perl
> 1888 ?        00:00:00 httpd-perl
> 1894 ?        00:00:00 libhttpd.ep
> 1901 ?        00:00:00 advxsplitlogfil
> 1902 ?        00:00:00 libhttpd.ep
> 1903 ?        00:00:00 libhttpd.ep
> 1904 ?        00:00:00 libhttpd.ep
> 1905 ?        00:00:00 libhttpd.ep
> 1942 ?        00:00:00 crond
> 1967 ?        00:00:00 lisa
> 2088 vc/1     00:00:00 mingetty
> 2089 vc/2     00:00:00 mingetty
> 2090 vc/3     00:00:00 mingetty
> 2091 vc/4     00:00:00 mingetty
> 2092 vc/5     00:00:00 mingetty
> 2093 vc/6     00:00:00 mingetty
> 2338 ?        00:00:00 startkde
> 2425 ?        00:00:00 kdeinit
> 2428 ?        00:00:00 kdeinit
> 2431 ?        00:00:00 kdeinit
> 2433 ?        00:00:02 kdeinit
> 2442 ?        00:00:03 artsd
> 2444 ?        00:00:01 kdeinit
> 2445 ?        00:00:00 kwrapper
> 2447 ?        00:00:01 kdeinit
> 2448 ?        00:00:05 kdeinit
> 2450 ?        00:00:07 kdeinit
> 2453 ?        00:00:15 kdeinit
> 2458 ?        00:00:01 kweatherservice
> 2460 ?        00:00:01 kdeinit
> 2463 ?        00:00:01 kdeinit
> 2465 ?        00:00:02 kdeinit
> 2466 ?        00:00:01 korgac
> 2468 ?        00:00:02 kdeinit
> 2469 ?        00:00:02 kmoon
> 2474 ?        00:00:01 kalarmd
> 2477 ?        00:00:11 kdeinit
> 2502 pts/1    00:00:00 bash
> 2556 pts/1    00:00:00 su
> 2564 pts/1    00:00:00 bash
> 2640 ?        00:00:00 kdeinit
> 2702 ?        00:02:12 mozilla-bin
> 2709 ?        00:00:02 kppp
> 2710 ?        00:00:00 kppp
> 2712 ?        00:00:00 gconfd-2
> 2713 ?        00:00:00 mozilla-bin
> 2714 ?        00:00:00 mozilla-bin
> 2715 ?        00:00:00 mozilla-bin
> 2716 ?        00:00:00 mozilla-bin
> 2721 ?        00:00:00 mozilla-bin
> 2722 ttyS1    00:00:00 pppd
> 2767 ?        00:00:00 esd
> 2775 ?        00:00:09 kdeinit
> 2827 pts/1    00:00:00 gconfd-2
> 2840 pts/1    00:00:00 ps
> 
> I don't see plain hppd there, but Mandrake startup and shutdown always 
> mentions it.
> 
> So, what am I doing wrong?
> 
> The book I am reading says to put files in "your web server document 
> root" before running them, but I don't know what this means.
> 
> I tried changing the file to:
> 
> <HTML>
> <BODY>
> <? phpinfo(); ?>
> </BODY>
> </HTML>
> 
> and that displays a blank page.
> 
> TIA
> 
> Joe
> 
> 
> 


-- 
Darin Perusich
Unix Systems Administrator
Cognigen Corp.
darinper at cognigencorp.com





More information about the nflug mailing list