Bobcares

Syntax error on line 31 of /etc/httpd/conf.d/php.conf in Plesk | Resolved

by | Dec 23, 2021

Syntax error on line 31 of /etc/httpd/conf.d/php.conf in Plesk resolved with a little help from our experts. 

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Let’s take a look at how our Support Team recently helped a customer  resolve the syntax error in the configuration file in Plesk.

What is “Syntax error on line 31 of /etc/httpd/conf.d/php.conf“ in Plesk

Have you been coming across a Syntax error message in the configuration file in Plesk recently? If yes, you may have also noticed one of the following symptoms:

    • Error message on the Plesk Home page:

      “Syntax error on line 31 of /etc/httpd/conf.d/php.conf“ in Plesk

    • We have to install System PHP manually from the OS repositories via the system package manager:
      tail /var/log/yum.log
      Dec 11 02:37:19 Installed: libzip-0.10.1-8.el7.x86_64
      Dec 11 02:37:19 Installed: php-common-5.4.16-48.el7.x86_64
      Dec 11 02:37:20 Installed: php-cli-5.4.16-48.el7.x86_64
      Dec 11 02:37:20 Installed: php-pdo-5.4.16-48.el7.x86_64
      Dec 11 02:37:20 Installed: t1lib-5.1.2-14.el7.x86_64
      Dec 11 02:37:20 Installed: php-gd-5.4.16-48.el7.x86_64
      Dec 11 02:37:20 Installed: php-mysql-5.4.16-48.el7.x86_64
      Dec 11 02:37:20 Installed: php-5.4.16-48.el7.x86_64
      Dec 11 02:37:20 Installed: php-ldap-5.4.16-48.el7.x86_64
      
      # history | grep php
      yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

According to our experienced Support Team, this error is due to PHP package in OS repositories with incorrect syntax. Moreover, this causes Plesk to demonstrate the symptoms seen above.

# tail -5 /etc/httpd/conf.d/php.conf
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"

Fortunately, modifying these parameters and adding the <IfModule mod_php5.c> tags will help us stay clear of this error.

How to resolve Syntax error on line 31 of configuration file in Plesk

Our Support Techs have come up with a way to resolve this error easily:

  1. First, we have to connect to the server using SSH.
  2. Then, we will create a backup of the configuration file with the command below:
    # cp /etc/httpd/conf.d/php.conf{,.orig}
  3. Then, we have to open the cp /etc/httpd/conf.d/php.conf{,.orig} and add the tags. We can open the file via any text editor and edit the syntax in order to include the tags:

    Before editing:

    php_value session.save_handler "files"
    php_value session.save_path "/var/lib/php/session"

    After editing:

    <IfModule mod_php5.c>
    php_value session.save_handler "files"
    php_value session.save_path    "/var/lib/php/session"
    </IfModule>

[Seeking a solution to another query? We are just a click away.]

Conclusion

In conclusion, the skilled Support Engineers at Bobcares demonstrated how to deal with the syntax error in the configuration file in Plesk by modifying the file and adding the <IfModule mod_php5.c> tags.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.