Home  >  Article  >  PHP Framework  >  Quick installation steps for Apache+PHP+MySQL+phpMyAdmin under Ubuntu

Quick installation steps for Apache+PHP+MySQL+phpMyAdmin under Ubuntu

不言
不言Original
2018-07-28 17:36:312650browse

How to deploy and install Apache PHP MySQL phpMyAdmin under Ubuntu? It may be a little unfamiliar to many friends. In the following article, I will bring you the command to quickly deploy and install Apache PHP MySQL phpMyAdmin under Ubuntu.

Installing Apache

sudo apt-get install apache2

To determine whether the installation was successful, let’s test it. Open the browser and enter the following URL: http://localhost/

If successful, you will see the following content "It works!" Congratulations, you have taken the first step. .

Install PHP5

Enter the following command in the terminal:

sudo apt-get install php5 libapache2-mod-php5

Restart Apache:

sudo /etc/init.d/apache2 restart

We create a new PHP test file (we name it phptest .php), enter the following content:

sudo vi /var/www/testphp.php

Enter the following content in the file.

<?php phpinfo(); ?>

Save and exit. Then open a browser and take a look at what we just created. Enter the following URL: http://localhost/testphp.php

If the PHP information page is displayed, it means you have taken another small step.

Install MySQL

Let’s install MySQL (This is the last step and the more troublesome step, so pay attention when installing.)

Open the terminal again and run The following command:

sudo apt-get install mysql-server

During installation, if you are asked to enter the MySQL password, enter the password. If there is no requirement, perform the following steps to set a password.

Enter the following command in the terminal:

mysql -u root

Next, you have to enter the following;

mysql> SET PASSWORD FOR &#39;root&#39;@&#39;localhost&#39; = PASSWORD(&#39;yourpassword&#39;);

and above The root is your MySQL username, and yourpassword is the new password corresponding to the username.

At this point, the LAMP environment has been set up. If you want to install phpMyAdmin to manage MySQL, continue below.

Install phpMyAdmin

Next we install phpMyAdmin. Enter the following command in the terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

The phpmyadmin here matches the PHP we installed before. If the PHP you installed does not match phpmyadmin, it will not work properly.

Now let’s solve the problem of phpMyAdmin “not working”. After we install phpMyAdmin, don’t think that everything is ready. In fact, we still have one more job to complete, which is to configure phpMyAdmin and Apache. Also run the following command in the terminal:

cp /etc/phpmyadmin/apache.conf /etc/apache2/sites-available/phpmyadmin

In this way we copy apache.conf (apache configuration file) in phpmyadmin to apache2/sites-available/phpmyadmin.

Then generate a soft link to phpmyadmin:

cd /etc/apache2/sites-enabled/
sudo ln -s ../sites-available/phpmyadmin phpmyadmin

Finally restart Apache:

sudo /etc/init.d/apache2 restart

Okay. Open http://localhost/phpmyadmin to experience it.

Recommended related articles:

Quickly install and deploy LAMP environment under Alibaba Cloud server--based on CentOS 6.3

lamp environment Configuration of LAMP environment configuration under Alibaba Cloud server under CentOS 6.3

Related course recommendations:

The latest five Laravel video tutorial recommendations in 2017

The above is the detailed content of Quick installation steps for Apache+PHP+MySQL+phpMyAdmin under Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

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