Prepare yourself for a role working as an Information Technology Professional with Linux operating system Conclusion You will see the PHP info page and confirm PHP-FPM is used with Apache. Now go your browser and point it to your server IP address or domain name followed by the info.php. Here we have configured /var/cd /var/www/html/domain/public sudo nano info.php sudo service apache2 restart Step 7: Verify PHP-FPM with Apache Now you can enable the new Apache configuration. Hit CTRL + X followed by Y and Enter to save and exit the file. Paste the below configuration in the file. sudo nano /etc/apache2/sites-available/ nf sudo service php8.1-fpm restart Step 6: Configure Apache Virtual HostsĬreate a new Apache vhost configuration. Once you have modified your PHP settings you need to restart your PHP-FPM for the changes to take effect. Hit F6 for search inside the editor and update the following values for better performance. Now we configure PHP for Web Applications by changing some values in php.ini file.įor PHP 8.1 with Nginx the php.ini location will be in following directory. If you need HTTP 2 support you can enable it also. Now you can enable PHP-FPM configuration. sudo a2enmod mpm_event proxy_fcgi setenvif Enable PHP FPM Configuration sudo a2dismod mpm_preforkĮnable Apache Event module. sudo a2dismod php7.4ĭisable Apache Prefork module. sudo a2dissite 000-default Enable Apache Event Moduleĭisable any default preform modules for any existing PHP versions. sudo apt install apache2 Step 4: Configure Apache with PHP-FPMīy default Apache will use mod_php so now you can configure Apache to use PHP-FPM.ĭisable the default Apache vhost configuration. Once you have your PHP-FPM up and running you can install Apache web server. Status: "Processes active: 0, idle: 10, Requests: 1068, slow: 0, Traffic: 0req/sec"ĬGroup: /system.slice/ Step 3: Install Apache Process: 564 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.s> Loaded: loaded (/lib/systemd/system/ enabled vendor preset: enabled)Īctive: active (running) since Tue 04:51:01 UTC 3min ago You will receive an output similar to the one below. Once the installation is complete verify the installation using the following command. sudo apt install php8.1-fpm php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-dev php8.1-imap php8.1-mbstring php8.1-soap php8.1-zip php8.1-bcmath -y Now we shall install PHP 8.1-FPM and some common modules to run a PHP application like WordPress. Once you have added the PPA you can install PHP 8.1. sudo apt install software-properties-common Note: Replace “” with your domain name.Add the ondrej/php which has PHP 8.1 package and other required PHP extensions. Create a new configuration file for your virtual host using the following command: sudo nano /etc/apache2/sites-available/.You can do this by running the following command: sudo a2enmod proxy_fcgi proxy To configure Apache to use PHP-FPM, you need to enable the “proxy_fcgi” and “proxy” modules.You can also enable PHP-FPM to start at boot time by running the following command: sudo systemctl enable php8.2-fpm.Once the installation is complete, you can start the PHP-FPM service by running the following command: sudo systemctl start php8.2-fpm.Note: Replace “8.2” with the required PHP versions (Like: 8.1, 7.4, 7.3, etc). Then install the PHP along with PHP-FPM, by running the following command in the terminal: sudo apt install php8.2 php8.2-fpm.To configure PPA, run the following commands: sudo apt install python-software-properties sudo add-apt-repository ppa:ondrej/php.So we always prefer to use ondrej/php PPA for installing PHP that contains most of the versions. The default repositories may not contain the latest PHP version packages. You can also enable Apache to start at boot time by running the following command: sudo systemctl enable apache2 Step 3: Install PHP-FPM Once the installation is complete, you can start the Apache service by running the following command: sudo systemctl start apache2 To install Apache on Ubuntu 22.04, run the following command in the terminal: sudo apt install apache2 You can do this by running the following command in the terminal: sudo apt update & sudo apt upgrade Step 2: Install Apache Step 1: Update your systemīefore installing any new software, you should update your system to ensure that all packages are up to date. In this article, we will provide a step-by-step guide on how to install Apache with PHP-FPM on Ubuntu 22.04. Combining the two can significantly improve the performance of a website. While Apache is the most popular web server used today, PHP-FPM is a FastCGI process manager that provides a faster and more efficient way to process PHP requests. Apache and PHP-FPM are both widely used in web development to serve dynamic content.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |