How do I setup php + My sql development environment in Ubuntu ?
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
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.
We must restart Apache afterwards:
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:
Pick the ones you need and install them like this:
Now restart Apache2:
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:
Now restart Apache:
phpMyAdmin is a web interface through which you can manage your MySQL databases.
install php5, php5-mysql, and mysql-server with the following command
If you will be hosting php5 applications on a web server, you may want to install apache and apache's php supporting module with the following command
I highly recommend you to trying LAMP Stack from Bitnami.
It's completely self contained and will not interfere with other software on your system.
If you unsatisfied with this, just delete the folder. Or execute uninstall script inside the folder for clean removal.
for ubuntu 14.04 or higher:
Make sure that the installation of the xdebug lib is in the correct folder:
That should output something like this:
Append both the
files with the following lines:
You'll need to restart the apache server:
That's it, you should be good to go. To check and make sure that everything is working correctly, you can use the phpinfo() analysis tool.
Create a php info file from the shell prompt:
open the the newly created file, select all and copy:
Finally, paste the output to https://xdebug.org/wizard.php and click the analyse button. The first section should say xdebug installed version 2.2.3, or whatever the latest version is.
Good luck, I hope this helped.