Skip to main content

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:

  1. Add a PPA (Personal Package Archive) for PHP 8.3

    sudo add-apt-repository ppa:ondrej/php
  2. Update the package repository

    sudo apt update -y
  3. Install PHP 8.3 & required modules

    sudo apt install php8.3 php8.3-fpm php8.3-mbstring php8.3-mysql php8.3-xml php8.3-zip -y
  4. 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

  1. Edit the PHP configuration file using the following command:

    sudo nano /etc/php/8.3/fpm/php.ini
  2. 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

  1. Install Gettext using the following command:

    sudo apt-get install gettext
  2. Add Locales using the following command:

    sudo locale-gen ml_IN.UTF-8
    sudo update-locale
  3. Restart the PHP-FPM service using the following command:

    sudo systemctl restart php8.3-fpm