Memfungsikan PHP di userdir Apache Ubuntu 10.10

Ketika apache dan php di install di Linux Ubuntu 10.10, php memang sudah bisa dijalankan di /var/www, tetapi ketika kita mengaktifkan modul userdir agar /home/username/public_html bisa digunakan, ternyata baru .html yang bisa diaktifkan, sedangkan *.php belum bisa berjalan. ini karena secara default php5.conf belum mengaktifkan php di public_html.

Bukalah file /etc/apache2/mods-enabled/php5.conf :

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule …> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
         <Directory /home/*/public_html>
             php_admin_value engine Off
         </Directory>
    </IfModule>
</IfModule>
 

Anda harus memberikan remark (#) seperti di bawah ini :

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule …> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
   # <IfModule mod_userdir.c>
   #     <Directory /home/*/public_html>
   #          php_admin_value engine Off
   #     </Directory>
   # </IfModule>

</IfModule>

Terakhir jangan lupa merestart Apache nya :

$ /etc.init.d/apache2 restart

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha Captcha Reload