Home > Backend Development > PHP Tutorial > Ubuntu14.04 builds LAMP environment, ubuntu14.04 builds lamp_PHP tutorial

Ubuntu14.04 builds LAMP environment, ubuntu14.04 builds lamp_PHP tutorial

WBOY
Release: 2016-07-13 10:21:01
Original
1039 people have browsed it

Ubuntu14.04 builds LAMP environment, ubuntu14.04 builds lamp

Install Apache2                                                                                                 

Install PHP module                                                   
<span>sudo</span> apt-get <span>install</span> apache2
Copy after login

Install Mysql                                                   

<span>sudo</span> apt-get <span>install</span> php5
Copy after login

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
Copy after login

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-gd
Copy after login
Install 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
Copy after login

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> phpmyadmin
Copy after login
Visiting 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
Copy after login

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
Copy after login


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
Copy after login

<span>sudo</span> gedit /etc/apache2/apache2.conf&
Copy after login
Copy after login

apache is easier to test. After success, use the browser to access localhost and you will see that it works!

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>?>
Copy after login

<span>sudo</span> gedit /etc/apache2/apache2.conf&
Copy after login
Copy after login
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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/862697.htmlTechArticleUbuntu14.04 builds LAMP environment, ubuntu14.04 builds lamp and installs Apache2 sudo apt-get install apache2 Install PHP module sudo apt-get install php5 install Mysql sudo apt-get install mysql- ser...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template