How to Find PHP FPM Error Log in Linux

In this tutorial we will locate the php fpm error log file using PUTTY. When we do development and try to setup the server we need this file in order to get all errors and other notices which will help us to solve the issue.

FPM or FastCGI Process Manager is an alternative of PHP FastCGI which has additional features especially for websites with a large number of visitors. PHP FPM is the best choice for high speed optimization websites.

Find PHP FPM error log

This tutorial assume that you have already installed php fpm on your server.

Open putty terminal and login as root to the server. Add the following line of code in the terminal:

find / -type d -name "php-fpm.d"

using the "-type d" command, we tell it to search for directories and the -name parameter is used for the name of the directory. After we run this command we will see the following output:

In order to find the right php fpm error log file you will have to know your current version of php. To find out the version you can write the following line of code in the terminal: php -v. After you get your php version open the correct folder in my case the correct folder for my php-fpm settings is /opt/cpanel/ea-php73/root/etc/php-fpm.d.

Using the following line of code we will open the directory and we will list the all files:

cd /opt/cpanel/ea-php73/root/etc/php-fpm.d
ls

The ls command will list all files in the directory. Now you have to open your domain configuration file. Lets assume that your website is example.com then, your configuration file should look like the following: example.com.conf. To open the file we will use the following command:

nano example.com.conf

Don't forget to replace example.com with your domain name. The file you open should look like something like that:

In the above screenshot you can see the exact path to the erro log file. If you want you can change the filepath as you wish. In order to actually apply the seetings you made in this file you will have to restart the php-fpm service. But before that you have to save the file. In case you don't know how to do that, hit CTRL + X and then pres Y and hit ENTER. Y stand for Yes, it will ask you if you want to save the settings.

After we made all changes we need we have to restart the php-fpm service in order to be applied all settings we did in the file, to do that we will run the following line of code in the terminal:

systemctl restart ea-php73-php-fpm

Once again, you have to know you current php version in order to be able to reset the service. You will have to replace the "ea-php73" with your current php version. Also if you have WHM you can restart the service directly from there.

How to restart PHP FPM using WHM.

Login in WHM using the root user and pass. In the search bar from top left corner type "fpm". Then in the bellow list will appear: PHP-FPM service for Apache, open the page and click on the restart button. That's it. Now you can change the path of the php fpm error log file as you wish. Also there are a lot of settings in that file you can make, basically this is the core file for your domain. If you have nginx server, from this file you can get the .sock file which is used to configure the NGINX block server, but this we will cover in other tutorial.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x