Home > Article > Backend Development > How to install php under linux
The open source nature of Linux brings great freedom to users, and also makes some developers like to use it for server-side application development. In Linux systems, installing PHP is a very common requirement. This article will introduce how to install PHP in Linux systems.
As an open source server-side scripting language, PHP itself also runs on many operating systems, including Linux. Installing PHP under Linux requires a combination of Apache and MySQL. First you need to install Apache.
Use apt-get command to install Apache in Linux system. First, open a terminal window and enter the following command:
sudo apt-get update
Note: Administrator privileges are required to complete this operation. If you do not have administrator rights, please contact the system administrator, or use another account that already has administrator rights.
After executing the above command, enter the following command to install Apache:
sudo apt-get install apache2
The user will get a prompt message asking whether to continue the installation. After confirmation, the system will automatically download and install Apache.
When the Apache installation is complete, enter the terminal window and enter the following command to update the system installer:
sudo apt-get update
Next, run the following command to install PHP and MySQL:
sudo apt-get install php5 mysql-server-5.5
This command will download and install PHP, MySQL and other related programs from the server.
The installation program will prompt the user to enter a MySQL root user password. Users need to set a password and confirm the password. During this process, the installer also prompts the user to confirm basic settings and permissions for MySQL.
After the installation is complete, users can verify whether PHP has been successfully installed by running the following command:
php -v
If everything is normal, this command will display the version number of PHP and other related system information.
If you need to install phpmyadmin, you can use the following command:
sudo apt-get install phpmyadmin
This command will download and install phpmyadmin. Then, users can access phpmyadmin through the browser and manage the MySQL database.
You need to pay attention to the following points when installing PHP on a Linux system:
Through the above method, installing PHP in the Linux system allows users to develop applications on the server side. In addition, in the open source environment of the Linux system, users can also freely choose to use other open source software to meet their own needs.
The above is the detailed content of How to install php under linux. For more information, please follow other related articles on the PHP Chinese website!