First Download Install Apache2
Input: sudo apt-get install apache2
After the installation is complete, enter in the browser: localhost displays as follows, stating that the installation is correct.
Immediately after installation php7.0
Input: sudo apt-get install php7.0
Once the installation is complete, install MySQL
Input: sudo apt-get install Mysql-server
4. Install additional modules
sudo apt-get install libapache2-mod-php7.0
sudo apt-get install php7.0-mysql
Restart Service
service apache2 restart
service mysql restart
Test Apache can parse PHP
在/var/www/html/中新建一个名为phpinfo.php的文件
The file reads:
<?php
echo phpinfo();
?>
Browser access: http://localhost/phpinfo.php
, the PHP version page appears
5. Modify Permissions
sudo chmod 777 /var/www
6. Installing phpMyAdmin
sudo apt-get install phpmyadmin
Install: Select Apache2, click OK. The next option is to configure the database and enter the password.
To create a phpMyAdmin shortcut:sudo ln -s /usr/share/phpmyadmin /var/www/html
To enable the Apache mod_rewrite
module:sudo a2enmod rewrite
Restart Service:
service php7.0-fpm restart
service apache2 restart
Test: Browser access:http://localhost/phpmyadmin
If you follow the author's thinking step by step to do now then you should be visiting localhost/phpmyadmin, of course, is likely to error, this time will prompt you do not install an extension mbstring, according to the page error message download the corresponding expansion
# sudo apt install sudo apt-get install php-mbstring php7.0-mbstring
A new error message may be added: PHP Fatal error:require_once (): ... A new installation is also required to expand
sudo apt-get install php-gettextsudo service apache2 reload/restart
lamp环境就搭好了
查看资料:http://www.linuxidc.com/Linux/2016-10/136327.htm
http://www.laixiaojieblog.cn/2016/05/28/ubuntu-16-04-lamp%E7%8E%AF%E5%A2%83%E6%89%8B%E5%8A%A8%E9%85%8D%E7%BD%AE%E4%BB%A5%E5%8F%8A%E9%97%AE%E9%A2%98%E8%A7%A3%E6%9E%90/
ubuntu-kylin16.04 Build lamp environment.