PHP

Kevin Kinsey kdk at daleco.biz
Sun Feb 20 03:18:51 GMT 2005


Andrei Iarus wrote:

>I have installed apache-1.3.33_1, php5-5.0.3_1. And I
>tried to run simple scripts like: 
><html>
> <head>
>  <title>PHP Test</title>
> </head>
> <body>
> <?php echo '<p>Hello World</p>'; ?>
></body>
></html>
>and the output was an unexpected one: 
>
> Hello World
>
>'; ?>
>It also doesn`t outputs anything when using the
>phpversion() function. A possible bug? Before
>reporting this as a bug, I wanted to check if there
>was someone else with similar problems(or may be I did
>something wrong). 
>  
>

Simple configuration needed.  Note that this is PHP4.

***These are my comments***  (be sure not to put _them_
into your httpd.conf).

-----------------------------------------------------------------------------------------------------------

#grep -A 2 php /usr/local/etc/apache/httpd.conf

LoadModule php4_module        /usr/local/libexec/apache/libphp4.so
    ***this is necessary.***

AddModule mod_php4.c
   ***so is this.***

        <IfModule mod_php4.c>
            DirectoryIndex index.php index.html
         </IfModule>

   ***tells Apache to use "index.php" as the preferred index,
          if not present, then use "index.html" if it exists***

    <IfModule mod_php4.c>
        AddType application/x-httpd-php .php .html .asp .php3
        AddType application/x-httpd-php-source .phps
   </IfModule>

   ***a little overkill, mostly for humor.  My development server
treats files ending in "php", "html" and "asp" as php files and
parses them looking for PHP (mostly as a political statement).***

-----------------------------------------------------------------------------------------------------------------

Basically, you must have 1]LoadModule 2]AddModule and
3]AddType declarations in httpd.conf, then restart Apache
and your scripts should work fine.

HTH, Kevin Kinsey


More information about the freebsd-questions mailing list