Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  4] [ 0]  / answers: 1 / hits: 6159  / 1 Year ago, mon, march 13, 2023, 10:07:05

How do I setup php + My sql development environment in Ubuntu ?

More From » 12.04


Apache2 With PHP5 And MySQL Support On Ubuntu Server

LAMP is short for Linux, Apache, MySQL, PHP.

Install an Apache2 webserver on an Ubuntu Server with PHP5 support (mod_php) and MySQL support.

Installing MySQL 5

sudo apt-get install mysql-server mysql-client

Installing Apache2

sudo apt-get install apache2

Apache's default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.

Installing PHP5

sudo apt-get install php5 libapache2-mod-php5

We must restart Apache afterwards:

sudo /etc/init.d/apache2 restart OR sudo service apache2 restart

Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

apt-cache search php5

Pick the ones you need and install them like this:

sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Now restart Apache2:

sudo /etc/init.d/apache2 restart OR sudo service apache2 restart

Xcache is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It's similar to other PHP opcode cachers, such as eAccelerator and APC. It is strongly recommended to have one of these installed to speed up your PHP page.

Xcache can be installed as follows:

sudo apt-get install php5-xcache

Now restart Apache:

sudo /etc/init.d/apache2 restart OR sudo service apache2 restart


phpMyAdmin is a web interface through which you can manage your MySQL databases.

sudo apt-get install phpmyadmin

[#34049] Wednesday, March 15, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 11
Total Questions: 121
Total Answers: 109

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago