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 to build php environment under linux

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

Share

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

This article mainly introduces how to build a php environment under linux, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

The method of building php environment under linux: 1. Through "sudo apt-get install mysql-server..." Wait for commands to install MySQL and Apache;2, enter "apt-get install php7.0..." on the terminal Just install PHP.

This article operating environment: ubuntu 16.04system, PHP7.0 version, Dell G3 computer.

Detailed steps of building PHP environment under Linux

Ubuntu16.04+MySQL+Apache+phpMyAdmin

1. Install MySQLsudo apt-get install mysql-serversudo apt-get install mysql-clientsudo apt-get install libmysqlclient-dev

During the installation process, you will be prompted to enter the database password, and after the installation is completed, enter the command to check:

Sudo netstat-tap | grep mysql

Installation succeeded

Simple configuration for the database:

# first edit the file / etc/mysql/mysql.conf.d/mysqld.cnf:sudo vim / etc/mysql/mysql.conf.d/mysqld.cnf# to find [mysqld] # add the server-side character encoding character-set-server=utf8collation-server=utf8_general_ci# so that the server can access it remotely, note bind-address#bind-address = 127.0.0.12. Install Apache2sudo apt-get install apache2

After the installation is complete, type http://localhost/ in the browser to check whether the installation is successful:

Installation succeeded

3. Install PHP

Terminal input:

Apt-get install php7.0 libapache2-mod-php7.0

Restart the Apache service after completion:

/ etc/init.d/apache2 restart

Test PHP installation successfully:

Sudo vim / var/www/html/info.php

Write code into it:

Save exit and enter in the browser:

Http://localhost/info.php

The following interface is displayed:

PHP installed successfully

4. During the installation of phpMyAdminsudo apt-get install phpmyadmin#, select apache2, select the configuration database, and enter the database password.

After the installation is complete, execute the command to establish a soft connection under / var/www/html:

Sudo ln-s / usr/share/phpmyadmin / var/www/html/phpmyadmin

Enter in the browser, the user name is root, and the password is the password of the database set above:

Http://localhost/phpmyadmin/

Installation succeeded

If insufficient folder permissions occur during the process, enter the command to modify / var/www/html permissions:

Sudo chmod 777 / var/www/htmlOK, at this point, a LAMP environment is built! If you have any questions, please leave a message for discussion.

Thank you for reading this article carefully. I hope the article "how to build a php environment under linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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