Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How ubantu executes commands to realize php installation

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how ubantu executes commands to achieve php installation". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "how ubantu executes commands to achieve php installation" together!

ubantu Execute the command to install php: 1. Open the terminal window;2. Enter the command "sudo apt-get install php5 libapache2-mod-php5" to install.

Operating environment: ubuntu 16.04 system, PHP5 version, DELL G3 computer

Install php in ubuntu:

About LAMP configuration steps under Ubuntu:

LAMP is Apache, PHP 5, MySQL 5.

Open the terminal and enter the command line.

1. install Apache

1. Open the terminal

2. enter the following command

sudo apt-get install apache2

3. If you do not have sudo privileges, you need to enter a password.

2. Testing Apache

To determine if the installation was successful, test it.

1. Open your browser and enter the following URL

http://localhost/

If successful, you'll see the following: "It works! "Congratulations, you've taken the first step.

3. Install PHP5

Step 1. Open Terminal (ctrl+alt+T).

Step 2. Enter the following command line:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP and Apache to work together, PHP needs to be configured and tested.

sudo /etc/init.d/apache2 restart

4. testing PHP

Step 1. Create a PHP test file (we call it phptest.php) and enter the following:

sudo gedit /var/www/testphp.php

Step 2. A text editor will open and type the following.

Step 3: Save the exit.

Step 4. Now open your browser and take a look at what you just created. Enter the URL below.

http://localhost/testphp.php

If PHP's informational content page appears, you've taken another small step.

5. install MySQL

Here's how to install Mysql5 (this is the last step, and it's also a troublesome step, pay attention when installing).

Step 1. Open the terminal again and enter the following.

sudo apt-get install mysql-server

Step 2. During installation, enter the Mysql password if required. If not, proceed to the next step. Enter the following command in the terminal.

mysql -u root

Later, enter the following:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

Above 'root' is your Mysql username and 'yourpassword' is your new password.

Step 3. The following will deal with the more difficult phpmyadmin. The problem that often occurs here is that phpmyadmin is clearly installed, but when entering http://localhost/phpmyadmin, there is no administrative interface, but there is no page found. No hurry, install phpmyadmin first and then solve it. Enter the following command:

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

phpmyadmin here is compatible with php5 installed earlier, if you install PHP and phpmyadmin do not match, they will not work.

Step 4. Now to fix phpmyadmin"not working" problem, don't think everything is ready when we install phpmyadmin. There's one more thing to do: configure phpmyadmin and apache2. The same terminal, input:

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

This will copy apache.conf from phpmyadmin to the phpmyadmin file under apache2/sites-available.

Step 5. Enter the following key into the sites-enabled folder:

cd /etc/apache2/sites-enabled/

Step 6. After entering, create a link to the configuration file so that you can use it. Input:

sudo ln -s ../ sites-available/phpmyadmin

Step 7. Restart Apache2

sudo /etc/init.d/apache2 restart

Finally, open http://localhost/phpmyadmin to experience it

Thank you for reading, the above is "ubantu how to execute the command to achieve php installation" content, after learning this article, I believe that everyone on how to execute the command to achieve php installation this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report