To install PHP 8.2 on Ubuntu 24.10, follow these simple steps.
Step 1 : Run the following command to ensure your system is up to date:
Step 2 : Since ppa:ondrej/php
does not officially support non-LTS versions of Ubuntu, do the following:
- Add the repository:
- Edit the repository source file:
Find the word "oracular" and replace it with "noble".
- Save and exit the file.
Step 3 : Run the following command again to update the package list:
Step 4 : Create a preferences file to pin the libgd3 package to the oracular release:
Add the following lines:
Save and exit the file.
Step 5 : Install PHP 8.2 core packages:
Step 6 : Install frequently used PHP extensions:
- php8.2-mysql: For MySQL database connectivity.
- php8.2-curl: For HTTP requests and API integrations.
- php8.2-xsl: For XML transformations.
- php8.2-gd: For image processing.
- php8.2-common: Contains common modules and libraries.
- php8.2-xml: For working with XML data.
- php8.2-zip: For creating and extracting ZIP files.
- php8.2-soap: For SOAP protocol support.
- php8.2-bcmath: For handling large numbers and precision math.
- php8.2-mbstring: For multibyte string processing.
- php8.2-gettext: For translations and internationalization.
- php8.2-imagick: For advanced image manipulation.
Step 7 : Check the PHP version to confirm successful installation:
Congratulations! You have successfully installed PHP 8.2 on Ubuntu 24.10.