Saturday, September 26, 2009

Steps on how to Fix Fatal error: Call to undefined function: mysql_connect()

1. command :sudo apt-get install php5-mysql
2. command :sudo dpkg-reconfigure php5-mysql
3. command :sudo /etc/init.d/mysql restart
4. command :sudo /etc/init.d/apache2 restart

Install chm reader in Ubuntu

command :sudo apt-get install xchm

Install unrar in Ubuntu

command :sudo apt-get install unrar
usage :unrar e

Steps in Installing cakePHP in Ubuntu

Installing CakePHP on Linux/Ubuntu is a bit tricky as you have to on the mod-rewrite and set the AllowOverride property from None to All. This is why I am giving you the exact steps to install CakePHP on your Ubuntu/Linux LAMP Server successfully so that your CakePHP index page shows with proper formatting with css.

1. Check the mod-rewrite whether it is enabled or not by running the following command:

sudo a2enmod rewrite

You will get a message like this “This module is already enabled!” if your mod-rewrite is already enabled. If mod-rewrite is not enabled, follow the on-screen instructions to install it.

2. Open and edit the default file from this directory /etc/apache2/sites-available/default by using the following command:

sudo nano /etc/apache2/sites-available/default

if you don’t know how to use nano, than you may use another way to set the write permission by running the following command though it’s not recommended ;)

sudo chmod -R 755 /etc/apache2/sites-available/default

3. Find the following Directory structure:


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


4. Find AllowOverride None and replace with the following text

AllowOverride All

5.Restart apache using:

sudo /etc/init.d/apache2 force-reload

And you are done! :)
Now you should now be able to view http://localhost/ with the correct css formatting for the cake default page.

Steps in Installing Apache, MySQL and PHP in Ubuntu

1. Install Apache. 
    command: sudo apt-get install apache2
2. Install PHP.
    command: sudo apt-get install php5 libapache2-mod-php5
3. Restart Apache.
    command: sudo /etc/init.d/apache2 restart
4. Install MySQL.
    command: sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
    note: When you get a prompt enter a password you would like to use as the root MySQL user.
          Once done open, ‘/etc/mysql/my.cnf‘ and change the bind-address to your local IP. (usually 192.x number).
5. Install phpmyadmin.
    command: sudo apt-get install phpmyadmin
   
    After finishing, you need to execute this command below for changing phpMyadmin folder to         var/www
   
    command :sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin
   
    note: After phpmyadmin is installed you can see it view it, http://localhost/phpmyadmin/.
       
6. Install MySQL Server.
    command :sudo apt-get install mysql-server
   
7. Use mod_rewrite.
    command :sudo a2enmod rewrite
             sudo /etc/init.d/apache restart
    note :Chances are you want to use mod_rewrite in your applications to make URLs a bit more               pretty. It is also required by lots of software, like Wordpress.
   
8. Starting and Stopping Apache.
     start      :sudo /usr/sbin/apache2ctl start
     stop       :sudo /usr/sbin/apache2ctl stop
     restart :sudo /usr/sbin/apache2ctl restart