Installing Apache and PHP5 with MySQL support

From LinodeWiki

Jump to: navigation, search

Please see the section in the Linode Library on LAMP Guides for more information and additional resources.


I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!


[edit] Apache Install

An Apache install is easy:

    apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

done!

[edit] MySQL Install

    apt-get install mysql-server mysql-client

Set the root password

    mysqladmin -u root password NEWPASSWORD

Just substitute the word NEWPASSWORD with your own password

Now that we have Apache and MySQL installed, we can move onto installing PHP. If you don’t require PHP then please feel free to skip.

[edit] PHP5 Install

In this example, I’m not going to install all the modules available. Just some common ones.

To see what modules are available try a:

    apt-cache search php5-

Note the ‘-’ at the end of ‘php5′. This will show any packages that start with ‘php5-’ and shows the available modules.

Due to using apt-get to install PHP5, any dependencies are taken care of:

This will install php with mysql support:

    apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd \
    php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-pspell php5-snmp \
    php5-sqlite php5-xmlrpc php5-xsl

Once done, do a quick Apache reload:

    /etc/init.d/apache2 reload

Done!



A nice recommendation would be to install phpmyadmin. Which is an easy to use php-based frontend for editing, adding, dropping and in general manipulation of MySQL tables.

To install phpmyadmin, simply:

     apt-get install phpmyadmin

It default installs in most system in /var/www/phpmyadmin, but feel free to move that directory around to a different directory. Just make sure that the directory is web accessible.


Sources: Router Mods I am the writer.

Personal tools