Home > Article > Backend Development > Ubuntu14.04 builds LAMP environment, ubuntu14.04 builds lamp_PHP tutorial
Install Apache2
<span>sudo</span> apt-get <span>install</span> apache2
Install Mysql
<span>sudo</span> apt-get <span>install</span> php5
Other module installation Test whether Apache is working properly
Open the browser and enter localhost to see if there is an It Works! webpage displayed. The directory is /var/www<span>sudo</span> apt-get <span>install</span> mysql-<span>server </span><span>sudo</span> apt-get <span>install</span> mysql-client
Modify permissions /var/www
sudo apt-get install libapache2-mod-php5 sudo apt-get install libapache2-mod-auth-mysql <span>sudo</span> apt-get <span>install</span> php5-mysql <span>sudo</span> apt-get <span>install</span> php5-gdInstall phpmyadmin
Select apache2 during the installation process and click OK. The next choice is to configure the database and enter the password. Test phpmyadmin
Then run http://localhost/phpmyadmin directly to see if database management software appears.
Configuration process The first step is to enable the mod_rewrite module
Restart the Apache server:<span>sudo</span> chomod <span>777</span> /var/www
Step 2: Set Apache to support .htm .html .php Add the following sentence: AddType application/x-httpd-php .php .htm .html Step 3 Test the php webpage
Edit mysql_test.php code as follows<span>sudo</span> apt-get <span>install</span> phpmyadminVisiting http://localhost/mysql_test.php and displaying 'Mysql configuration is correct' means the configuration is correct.
Step 4: How to solve the problem if garbled characters appear in the third step
Open configuration file Add the following code: AddDefaultCharset UTF-8
So far the configuration is OK.<span>sudo</span> <span>ln</span> -s /usr/share/phpmyadmin /var/www
I am the dividing line between the king of heaven and the tiger on earth Reference: http://blog.csdn.net/callmeback/article/details/8130190
<span>sudo</span> a2enmod rewrite
How to test whether the LAMP environment in the ubuntu server version is successfully built
<span>sudo</span> /etc/init.d/apache2 restart或者sudo service apache2 restart
<span>sudo</span> gedit /etc/apache2/apache2.conf&
php can be tested with phpinfo(); or php probe. It is recommended to find a probe and put it on the server. In the future, If you need it, the one from Wushuang Castle is good
MySQL recommends using phpmyadmin, and it is also recommended to leave it on the server after use. It is very convenient to manage and back up MySQL<?<span>php </span><span>$link</span> = <span>mysql_connect</span>("localhost", "root", "password"<span>); </span><span>if</span>(!<span>$link</span><span>) </span><span>die</span>('Could not connect: ' . <span>mysql_error</span><span>()); </span><span>else</span> <span>echo</span> "Mysql 配置正确!"<span>; </span><span>mysql_close</span>(<span>$link</span><span>); </span>?>
<span>sudo</span> gedit /etc/apache2/apache2.conf&LAMP environment construction, which one is better, Ubuntu Server or CentOS for Linux version?
CentOS is obviously more stable and there are many online tutorials.