- Регистрация
- 9 Май 2015
- Сообщения
- 1,483
- Баллы
- 155

PHP 8.4 brings exciting features and improvements that enhance performance and usability for developers. In this guide, we will walk through the steps to install PHP 8.4 and its essential extensions on an Ubuntu server.
Prerequisites
Before you begin, ensure you have:
- An Ubuntu server (20.04 or later).
- Sudo privileges to install packages.
- An active internet connection.
First, update your package list to ensure you have the latest information on available packages:
sudo apt update
Step 2: Install Required Dependencies
Next, install the necessary dependencies for PHP:
sudo apt install software-properties-common
This package allows you to manage software repositories easily.
Step 3: Add the PHP Repository
To install PHP 8.4, you need to add the repository that contains it. Use the following command:
sudo add-apt-repository ppa:ondrej/php
After adding the repository, update your package list again:
sudo apt update
Step 4: Install PHP 8.4 and Extensions
Now, you can install PHP 8.4 along with some commonly used extensions. Run the following command:
sudo apt install php8.4 php8.4-zip php8.4-xml php8.4-gd php8.4-mysql php8.4-pgsql php8.4-intl php8.4-curl
Explanation of Extensions
- php8.4-zip: Enables ZIP file handling.
- php8.4-xml: Supports XML parsing and manipulation.
- php8.4-gd: Provides functions for image processing.
- php8.4-mysql: Allows interaction with MySQL databases.
- php8.4-pgsql: Enables PostgreSQL database connectivity.
- php8.4-intl: Provides internationalization support.
- php8.4-curl: Facilitates data transfer with URL syntax.
Once the installation is complete, verify that PHP 8.4 is installed correctly by checking the version:
php -v
You should see output indicating that PHP 8.4 is installed.
Step 6: Configure PHP (Optional)
You may want to configure PHP settings based on your application requirements. The main configuration file is located at:
/etc/php/8.4/cli/php.ini
Edit this file using your preferred text editor:
sudo nano /etc/php/8.4/cli/php.ini
Make any necessary changes and save the file.
Step 7: Restart the Web Server
If you're using a web server like Apache or Nginx, restart it to apply the changes:
For Apache:
sudo systemctl restart apache2
For Nginx:
sudo systemctl restart nginx
Conclusion
You have successfully installed PHP 8.4 and its essential extensions on your Ubuntu server. With these tools at your disposal, you can start building modern web applications that leverage the latest features of PHP. Happy coding!
Источник: