Home >Backend Development >PHP Problem >How to install PHP on different operating systems
Developing and managing a website requires countless components and tools. A very important part of it is PHP. PHP is a server-side scripting language that is an integral part of many websites, content management systems (CMS), and e-commerce platforms. In this article, we will show you how to install PHP on different operating systems.
For Windows, you can install PHP through the following methods:
phpinfo( );
?>
Save the file and place it in the content path of the web server. Launch a web browser and navigate to localhost/index.php, which should display the version of PHP enabled on your system and all settings configured through the php.ini file.
For macOS, you can install PHP through the following methods:
brew install php
phpinfo( );
?>
Save the file and place it in the content path of the web server. Launch a web browser and navigate to localhost/index.php, which should display the version of PHP enabled on your system and all settings configured through the php.ini file.
For Linux system, you can install PHP in the following way:
sudo apt-get install php5 libapache2-mod-php5 -y
This will install PHP 5.x core as well as Apache 2.x and mod_php. You can upgrade it to PHP 7.x using the following command:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2
phpinfo( );
?>
Save the file and place it in the content path of the web server. Launch a web browser and navigate to localhost/index.php, which should display the version of PHP enabled on your system and all settings configured through the php.ini file.
Summary
These are a few ways to install PHP on different operating systems. In each case, you need to ensure that the PHP.ini file is configured correctly to enable the required PHP extensions. No matter which method you choose, just follow these steps and you can easily install PHP to power your next web project.
The above is the detailed content of How to install PHP on different operating systems. For more information, please follow other related articles on the PHP Chinese website!