Linux下快速搭建PHP环境(linux 搭建 php)

recently, due to the outbreak of novel coronavirus, more and more people need to work from home. Fortunately, with the help of Linux system and php, people can easily build a development environment at home. Therefore, for those who want to build a php development environment quickly under Linux, here are some tips.

Step 1: Install Apache on Linux

You can first use the command “sudo apt-get install apache2” to install Apache service. In addition, you can also your web server directory/var/www/html in the web browser, if it is displayed as a normal web page, it means Apache has been installed successfully.

Step 2: Install PHP

Then use the command “sudo apt-get install php7 libapache2-mod-php7 php7-mcrypt” to install the PHP service which is supported by Apache. After installation is complete, do not forget to run “sudo /etc/init.d/apache2 restart” to restart Apache service.

Step 3: Install MySQL

If you need to use MySQL, you can use the command “sudo apt-get install mysql-server mysql-client ” to install the MySQL service. After installation is complete, run “mysql -u root -p” to start mysql login mode and then enter “show databases;” to check if MySQL has been installed successfully.

Step 4: Install PhpMyAdmin

After installation of mysql is complete, use “sudo apt-get install phpmyadmin apache2-utils” to install phpMyAdmin which can be used to manage MySQL databases and users through a web browser. After installation, you need to configure some config files in the etc/phpmyadmin folder.

Apart from the steps above, you still need to configure some specific PHP settings in the config files. It is recommended that you follow the relevant tutorials on web regularly and update the related environment as soon as possible to ensure the security and stability of your work environment.

In a nutshell, building a php development environment under Linux is not that difficult. After following the steps above, you can quickly build the php development environment under Linux and successfully run the php programs.


数据运维技术 » Linux下快速搭建PHP环境(linux 搭建 php)