LAMP with Ubuntu
I have a new install of Ubuntu 11.04 beta installed on a machine, and I wanted to use it to do some web development, so I needed to install Apache2 with PHP5 and MySQL. All I needed to do was run a simple command.
sudo apt-get install mysql-server mysql-client apache2 php5 libapache2-mod-php5 |
You’ll then need to restart apache to get php working.
sudo /etc/init.d/apache2 restart |
You may view you phpinfo by editing a file in /var/www/
sudo gedit /var/www/info.php |
add the following to the info.php.
<?php phpinfo(); ?> |
Now visit http://localhost/info.php to view your php info. You may also want to add additional things to php5. You may search the repository using
sudo aptitude search php5 |
Then once you found what other things you’d like to have installed you may do so by entering something like
sudo aptitude install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json |
Usually I need to have mod_rewrite enabled for my applications to work.
sudo a2enmod rewrite |
Finally you may want to install phpmyadmin for working with your MySQL databases
sudo apt-get install phpmyadmin |
Sometimes I have to edit /etc/apache2/sites-available/default and change “AllowOverride None” to “AllowOverride All”