Ubuntu/installing Apache and PHP5 with MySQL support

From LinodeWiki

Jump to: navigation, search

Please see the articles in the Linode Library on Setting Up a LAMP Server on Ubuntu 8.04 LTS (Hardy) and Setting Up a LAMP Server on Ubuntu 9.04 (Jaunty) 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!

Apache Install

An Apache install is easy:

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

done!

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

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!

Source: [1] I am the writer.

Personal tools