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

Start Using Zend Framework 1.11

Zend Framework is one of popular PHP Framework which mostly use for enterprise application. So it will be a little bit complex for the beginers. But don’t worry, I am a beginers too :). I assume that your server is the same with mine, it use linux/unix operating system and can be accessed by ssh/telnet. When I wrote this post, I still use ZF ver. 1.11.

Ok then, lets rock !

1. Get Zend Framework and prepare your site based on Zend Framework

We will get the latest zend framework ini minimal configuration , extract and rename it (I choose ZendFramework-1.11.9-minimal) to ZendFramework then place it under public_html directory (or you can place as you like).

# cd /home/username/public_html

# tar -zxvf  ZendFramework-1.11.9-minimal.tar.gz

# mv ZendFramework-1.11.9-minimal ZendFramework

We will use Zend Tools which located in ZendFramework/bin/zf.sh, so we need to create an alias. You need to modify /home/username/.bashrc by add the text bellow at the end of file :

alias zf.sh=/home/username/public_html/ZendFramework/bin/zf.sh

After you modify this file, you need to re-login. Now, every time You login, Zend tools is ready to use 🙂

Check your Zend Tools :

# zf.sh show version

Zend Framework Version: 1.11.9

2. Create a ZF project (let say “zfstart”).

# cd /home/username/public_html

# zf.sh create project zfstart

3. Create a symbolic link of your zend library to your project library directory

# cd /home/username/public_html/zfstart/library

# ln -s /home/username/public_html/ZendFramework/library/Zend

4. And finaly you will have zfstart project directory structure bellow:

5. Test your project

http://yourdomain/zfstart/public

Then you should see like this bellow :

Congratulation !

1 2 3 4