phplinuxapache2

How do I build / get libphp5.so?


I am running SUSE from an Amazon image which came pre loaded with apache2 and PHP. I have got my website up and running with a test index.html file, which works. When I do a index.php test my browser tries to download the file. Now I think this is because PHP / Apache2 is not configured correctly.

The bit I think I need in httpd.conf is

LoadModule php5_module modules/libphp5.so

I have added this block already

<Files *.php>
   SetOutputFilter PHP
   SetInputFilter PHP
   LimitRequestBody 9524288
</Files>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

I have installed apache2-mod_php5 via zypper with the expectation that would add libphp5.so somewhere - however I can't find it. I have seen people mentioning it is built somehow in the installation of php / apache. I updated Apache2 and PHP via zypper and nada.

how do I get the file?


Solution

  • The module is called mod_php5.so and lives under

    /usr/lib64/apache2/mod_php5.so
    

    It's living there along with a lot of other mods, but the php5 module is not included anywhere!

    So the line to add to the config (/etc/apache2/sysconfig.d/loadmodule.conf) is

    LoadModule php5_module /usr/lib64/apache2/mod_php5.so
    

    I also used the below command to enable the mod

    a2enmod php
    

    Also don't forget to restart Apache2 and clear your browser cache.

    httpd2 -k -restart