Home  >  Article  >  Backend Development  >  PHP Learning Record Part 1: Installation of LAMP under Ubuntu1404

PHP Learning Record Part 1: Installation of LAMP under Ubuntu1404

WBOY
WBOYOriginal
2016-07-29 08:51:291219browse

I will be learning PHP full-stack development in the near future, and will write a series of articles to summarize the learning process to encourage myself.

The first article records the installation of the LAMP environment

0. Install the Apache Web server

Update the system before installation

sudo apt-<span>get</span> update && sudo apt-<span>get</span> dist-upgrade

Then install Apache

sudo apt-<span>get</span> install apache2

At this time, enter localhost in the browser You can see "It works!", indicating that the installation is successful.

PHP Learning Record Part 1: Installation of LAMP under Ubuntu1404

1. Install the MySQL database

sudo apt-<span>get</span> install mysql-server php5-mysql

Then there are some security settings, including root password, remote login, etc.

sudo mysql_secure_installation

Choose Y/n according to your needs, it’s OK.

2. Install PHP

Install php5 and some useful extensions (php5-curl, php5-imagick, etc.):

sudo apt-<span>get</span> install php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-imagick php5-cli

Modify Apache’s dir.cof file to let Apache search first index.php:

<ifmodule mod_dir.c><span>    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</span></ifmodule>

Then restart the Apache web server:

sudo service apache2 restart

3. Modify the root directory of the website

You need to modify two configuration files

1) Modify /etc/apache2/apache2. conf, find <code><directory></directory>, replace <code>/var/www/ with your own directory

2) Modify <code>/etc/apache2/sites-available/000- default.conf, find DocumentRoot /var/www/html, replace <code>/var/www/html with your own directory

and then restart Apache

sudo service apache2 restart

3) Copy the "index.html" file Go to your root directory

cp /<span>var</span>/www/html/index.html /自己的根目录

4. Summary

At this point, the LAMP environment is installed, and you can develop your own website in the future.

Reference links:

[1] ZH cheese: Ubuntu 14.04 installs LAMP (Linux, Apache, MySQL, PHP)

[2] Ubuntu 14.04 installs Apache

The above introduces the first part of the PHP learning record: the installation of LAMP under Ubuntu1404, including the relevant content. 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