Apache PHP

Rob Schumann yellowdog-general@lists.terrasoftsolutions.com
Fri May 17 22:00:01 2002


Hi Paul,

On 17-05-2002 Paul Guba wrote:

 > Has anyone enabled PHP in Apache.  Not sure if I need to
 > recompile Apache or just activate a module.  PHP4 is installed
 > on my machine but not sure if it was installed as a module or
 > CGI it can be either according to a tutorial I'm reading.  I
 > have added AddType application/x-httpd-php4 .php4 to my virtual
 > server directive but not sure if this is correct as the
 > tutorial refers PHP3.  It also seems that the module is on by
 > default on the server but my scripts don't seem to work.

If you are running YDL 2.2 (I can't speak for earlier versions) then apache/PHP should work "out-of-the-box".

You can confirm this by placing the following lines in a file and saving it to /var/www/html    call it whatever you want, but give it .php extension.

<?php
    phpinfo ();
?>

Run your browser and load the page http://localhost/yourfilename.php

If php is running correctly then you will get a dump of the apache/PHP environment.

If that is the case and your php scripts don't run then the problem lies elsewhere.

Apache/PHP/MySQL should also work out of the box, but there is a problem with the way php is configured in that the mysql.so is not located and so mysql calls will not work.

Change the /etc/php.ini file to include the lines (you will see where, approx 2/3 of the way down the file:

extension_dir = /usr/lib/php4

and

extension = mysql.so

you can also, if you have need, add other shared libraries thus:

extension = imap.so
extension = ldap.so
extension = odbc.so
extension = pgsql.so

To summarise, if you are on YDL 2.2 then PHP SHOULD already be working, without the need to build from source and without the need to make changes to your /etc/httpd/conf/httpd.conf file.

To get MySQL working with Apache/PHP then you will need to make the above changes to the php.ini file.

Hope this helps.

Good luck

Rob