PHP Configuration
PHP is a popular programming language used for web development. To install the latest version of PHP & to configure it, please follow the steps mentioned below:
- Ubuntu
-
Add a
PPA
(Personal Package Archive) for PHP 8.3sudo add-apt-repository ppa:ondrej/php
-
Update the package repository
sudo apt update -y
-
Install
PHP 8.3
& required modulessudo apt install php8.3 php8.3-fpm php8.3-mbstring php8.3-mysql php8.3-xml php8.3-zip -y
-
Configure
PHP-FPM
We need to configure PHP-FPM (FastCGI Process Manager) to work with the Web Server. Edit the PHP-FPM configuration file using the following command:
sudo nano /etc/php/8.3/fpm/pool.d/www.conf
Find the following lines and uncomment them:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
PHP.ini Configuration
-
Edit the PHP configuration file using the following command:
sudo nano /etc/php/8.3/fpm/php.ini
-
Update the following values:
memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 360
max_input_time = 360
Composer Installation
Install Composer using the following command:
sudo apt install composer
i18n Setup
-
Install Gettext using the following command:
sudo apt-get install gettext
-
Add Locales using the following command:
sudo locale-gen ml_IN.UTF-8
sudo update-locale -
Restart the PHP-FPM service using the following command:
sudo systemctl restart php8.3-fpm