Home  >  Article  >  Backend Development  >  Ubuntu php lamp environment construction

Ubuntu php lamp environment construction

WBOY
WBOYOriginal
2016-08-08 09:25:101006browse

Installation process
The first step is to install Apache2
sudo apt-get install apache2
The second step is to install the PHP module
sudo apt-get install php5
The third step is to install Mysql
sudo apt-get install mysql-server
sudo apt-get install mysql-client
Step 4: Install other modules
sudo apt-get install libapache2-mod-php5
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo apt-get install php5 -gd
The fifth step is to test whether Apache is working normally
Open the browser, enter localhost, and see if there is an It Works! web page displayed. The directory is /var/www
Step 6 Modify permissions /var/www
sudo chomod 777 /var/www
Step 7 Install phpmyadmin
sudo apt-get install phpmyadmin
Select apache2 during the installation process and click OK. The next choice is to configure the database and enter the password.
Step 8 Test phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www
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
sudo a2enmod rewrite
Restart the Apache server: sudo /etc/init.d/apache2 restart or sudo service apache2 restart
The second step is to set Apache support .htm .html .php
sudo gedit /etc/apache2/apache2.conf&
Add the following sentence: AddType application/x-httpd-php .php .htm .html
The third step is to test the php webpage
Edit the mysql_test.php code as follows:
$link = mysql_connect("localhost", "root", "password");
if(!$link)
die('Could not connect: ' . mysql_error());
else
echo "Mysql is configured correctly!";
mysql_close($link);
?>
Visiting http://localhost/mysql_test.php and displaying 'Mysql configuration is correct' means the configuration is correct.
The fourth step and the third step are the solutions after garbled characters appear here
Open the configuration file sudo gedit /etc/apache2/apache2.conf&
Add the following code: AddDefaultCharset UTF-8
Restart apache
sudo service apache2 restart

That’s it Configuration OK.

Original link http://blog.csdn.net/callmeback/article/details/8130190


The above has introduced the establishment of the ubuntu php lamp environment, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:WebService-php- 2(17)Next article:WebService-php- 2(17)