Published on Monday, March 17th, 2008 at 4:07 pm

Step 1 > Apache2
$sudo apt-get install apache2

Step 2 > MySQL 5
$sudo apt-get install mysql-server libmysqlclient15-dev

Step 3 > PHP5
$sudo apt-get install php5 php5-common libapache2-mod-php5 php5-gd php5-dev curl libcurl3 libcurl3-dev php5-curl

Step 4 > PHPMyAdmin
$sudo aptitude install phpmyadmin

Step 5 > SSL certificate for Apache2
$sudo apache2-ssl-certificate

If you get back that it can’t find apache2-ssl-certificate .. then not to worry, this is a known bug, and please read my comment at the bottom.. direct link to the comment click here

Answer the questions
$sudo a2enmod ssl
This enables the ssl mod for apache2

$echo “Listen 443″ | sudo tee -a /etc/apache2/ports.conf

$sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl

$sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl

$sudo gedit /etc/apache2/sites-available/ssl

add line :

NameVirtualHost *:443

<virtualhost *:443>
        ServerAdmin webmaster@localhost

        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/apache.pem

        DocumentRoot /var/www/
        <directory />
                Options FollowSymLinks
                AllowOverride None
        </directory>

        <directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2’s default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        </directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <directory “/usr/lib/cgi-bin”>
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ “/usr/share/doc/”
    <directory “/usr/share/doc/”>
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </directory>

</virtualhost>

Then we need to change the default file, so…

$sudo gedit /etc/apache2/sites-available/default
and make sure the following lines say this:

NameVirtualHost *:80
<virtualhost *:80>

You may also want to enable mod_rewrite.. todo so, follow the following steps:
$sudo a2enmod rewrite

You will also need to edit sites-available default, and ssl:
$sudo gedit /etc/apache2/sites-available/default
And the same again for the ssl file.
Here you will need to change the section which says ‘AllowOverride None’ to:

AllowOverride All

Now restart apache

$sudo apache2 -k restart

Step 6 > PDO & PDO_MySql

First, we need to install PEAR, so…
apt-get install php-pear

If you get anything about warning, ‘phpize’, this means you need php-dev, or if your using sypantic package manager, ‘php5-dev’.
$sudo pecl install pdo

This installs pdo.
The next thing you want todo is install the pdo_mysql drivers. Do this by doing the following:
$sudo pecl install pdo_mysql

If however you get a error somthing along the lines of:
checking for MySQL support for PDO… yes, shared
checking for mysql_config… not found
configure: error: Cannot find MySQL header files under
ERROR: `/tmp/tmpRiQ5ax/PDO_MYSQL-1.0.2/configure’ failed

Then you should download and install the following packages:
$sudo apt-get install libmysqlclient15-dev

and then try to re-install pdo_mysql.

Once this is finished and sucessful (it was for me), its best to then run the following code:

$sudo updatedb
$sudo gedit /etc/php5/apache2/php.ini

Inside the php.ini, at the bottom, add the following lines:

extension=pdo.so
extension=pdo_mysql.so

The end

ref : http://www.theatons.com/blog/2007/07/01/ubuntu-install-php5-mysql-apache2-ssl-pdo-pdo_mysql/

Related Posts

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>