To install PHP 8.0 on Ubuntu 23.04, follow the steps below.
Step 1 : Ensure your system is up-to-date by running the following command:
Step 2 : Add the Repository
Since ppa:ondrej/php
does not officially support non-LTS versions, you need to make a small modification.
- Add the repository:
- Open the repository file:
- Find "lunar" and replace it with "jammy". Save the changes.
Step 3 : Update
Update the package list again:
Step 4 : Create Pinning Preferences
Create a preferences file:
Add the following code to prioritize the correct package version:
Step 5 : Install PHP 8.0 core packages:
Step 6 : Install frequently used PHP extensions along with brief explanations:
- mysql: MySQL database support
- curl: cURL library for making HTTP requests
- xsl: XSL module for XML manipulation
- gd: GD Graphics Library for image processing
- common: Common functions and classes
- xml: XML support
- zip: Zip archive support
- soap: SOAP protocol support
- bcmath: Arbitrary precision mathematics
- mbstring: Multibyte string support
- gettext: Gettext module for multi-language support
- imagick: ImageMagick PHP extension for image processing
Step 7 : Check PHP Version
Verify the PHP version installed:
Congratulations! You have successfully installed PHP 8.0 on Ubuntu 23.04 with necessary extensions. Happy coding!