Sunday, December 26, 2010

How to run PHP files inside public_html directory in Ubuntu 10.10 a.k.a Maverick Meerkat

By default, php files doesnt gets interpreted when placed inside public_html in Ubuntu 10.10. ie in Maverick Meerkat.

When you install php5 in ubuntu 10.10 or 10.04, planning to place your php files inside public_html directory in your user area, here is the solution for you.

Create public_html in your user area

First of all check whether enable-modules under your apache server
for that
goto /etc/apache2/mods-enabled/ folder and check userdir.conf, userdir.load modules are enabled by simply typing ls command

if not then goto /etc/apache2/mods-enabled and create symbolic link as follow

sudo ln -s ../mods-available/userdir.load

sudo ln -s ../mods-available/userdir.conf

or you can enable using the following command

sudo a2enmod userdir

Finally create public_html folder under your home directory an give full access permission to it.

Restart your apache server (sudo /etc/init.d/apache2 restart or service apache2 force-reload)

Access it through following link.

http://localhost/~[your_home_directory_name]/ (for me it's http://localhost/~hariharank12/)

To run PHP files inside public_html in Ubuntu 10.10

In the new php.conf file which is present in /etc/apache2/mods-available/php5.conf, the php engine inside user directory is turned off as like below.

 php_admin_value engine Off

Comment those above lines.

Finally php5.conf will look like below.

        SetHandler application/x-httpd-php
        SetHandler application/x-httpd-php-source
    # To re-enable php in user directories comment the following lines
    # (from  to .) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
#            php_admin_value engine Off

Again restart the apache web server.

Test with some php files placing inside public_html folder and hitting URL with localhost/~username/php_file_name.

It should work now! :)

For more detailed description why php files running inside public_html is disabled, see the following link

Chmsee instead of Gnochm in Ubuntu 10.10

If you are wondering, how to open chm files in Ubuntu 10.10, here is a solution for you.

Gnochm has been removed from the repository, and instead replaced by chmsee.

chmsee has the following features.

A chm file viewer written in GTK+

- Uses gecko rendering engine
- Bookmarks
- Support to open multiple files at once

one difference I feel is you cannot search in chmsee application.

Simply you can install chmsee like

apt-get install chmsee