how to install php in ubuntu?
To install PHP on Ubuntu, follow these steps:
-
Update the package index:
- Open a terminal window and run the following command:
sudo apt update
- Open a terminal window and run the following command:
-
Install the PHP package:
- Run the following command to install the PHP package:
sudo apt install php
- Run the following command to install the PHP package:
-
Verify the installation:
- To check the version of PHP installed on your system, run the following command:
php -v
- To check the version of PHP installed on your system, run the following command:
-
Install additional PHP modules (optional):
- To install additional PHP modules, use the following syntax:
sudo apt install php-<module-name>
- Replace
<module-name>
with the name of the module you want to install. For example, to install the PHP MySQL module, run the following command:sudo apt install php-mysql
- To install additional PHP modules, use the following syntax:
Note: These steps will install the latest version of PHP available in the Ubuntu package repository. If you need to install a specific version of PHP, you can do so using a third-party repository or by compiling PHP from source.
Also Read : How to Check check php version command line linux?
That’s it! You have successfully installed PHP on Ubuntu. Now, you can start using PHP for your web development projects.