Recently began to learn PHP development, so first understand the following how to prepare the development environment under Ubuntu, during the review of a lot of articles, but also encountered a lot of problems, special records are as follows, I hope that other developers can be helpful:
1. Install the base package
Http://howtoubuntu.org/how-to-install-lamp-on-ubuntu
Refer to the above steps for the line.
2. Point the apache2 localhost default path to the development path you need
The default path is under/var/www/html, and it is believed that most developers will not develop the directory directly, changing the default path by following these steps:
1) Modify the/etc/apache2/sites-available/000-default.conf configuration file
To prevent modification errors, you can first back them up:
sudo cp/etc/apache2/sites-available/000-default.conf/etc/apache2/sites-available/000-default.conf.bak
And then start to modify it:
sudo vim/etc/apache2/sites-available/000-default.conf
The following configuration file omits the comment section:
<virtualhost *:80> ServerName localhost ServerAdmin [email protected] documentroot/home/ Destiny1020/site/test errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log Combined</virtualhost>
There are actually just a few places to modify:
I. Plus servername localhost---this is to avoid a warning that a servername does not exist when Apache2 is started.
II. Modify the DocumentRoot---modified to your target development path.
2) Modify apache.conf
sudo vim/etc/apache2/apache2.conf
Locate the section that defines the directory where one of the defined paths is/var/www/html, modifying its path to the target path (that is, the path specified in the first step), and the others do not need to be changed:
<Directory/home/destiny1020/Site/test/> Options Indexes followsymlinks allowoverride None Require All granted</directory>
It is important to note that the path needs to end with a "/". (I'm not going to ask if it's really necessary)
3. Installing phpMyAdmin
sudo apt-get install phpMyAdmin
Halfway will let you configure which server you need to enable, select Apache2.
You will then be asked if you want to configure the DB, if you have not configured it before, then choose Yes, then you will be asked for the MySQL admin password.
Next, you will be asked to enter a password, which is used to register phpMyAdmin with the DB, and if you enter directly, a random password is generated. Here I have entered a custom password. Because of the fear of generating a random password after any adverse consequences.
After the installation is complete, the following configuration is required for http://localhost/phpmyadmin/to be accessible:
1) Modify/etc/apache2/apache2.conf
sudo vim/etc/apache2/apache2.conf
At the end of the file add:
Include/etc/phpmyadmin/apache.conf
2) Finally restart the apache2 to ensure that the changes take effect:
Sudo/etc/init.d/apache2 restart
Visit http://localhost/phpmyadmin/and log in.
It feels like you need to enter MySQL username and password. So you can log in using root and the corresponding password.
Here, the lamp environment under Ubuntu is ready to be completed.
If you find any problems, please leave me a message.
Thank you!
Ubuntu 14.04 Installation Lamp development environment