PHP Parse error:  syntax error, unexpected

Encountered numerous PHP syntax errors in Drupal 7 while checking the error log file:

[01-Sep-2020 17:31:23 Asia/Manila] PHP Parse error:  syntax error, unexpected ''< /ul>'' (T_CONSTANT_ENCAPSED_STRING) in /home/website/public_html/modules/php/php.module(80) : eval()'d code on line 4
[01-Sep-2020 17:31:41 Asia/Manila] PHP Parse error:  syntax error, unexpected ''< /ul>'' (T_CONSTANT_ENCAPSED_STRING) in /home/website/public_html/modules/php/php.module(80) : eval()'d code on line 4

While this can be specific to custom coding or even server-level, fixing this website or Drupal level might help.

Three solutions on how to avoid and/or fix the error:

  1. If website is running on PHP version lower than 7.x, try to switch PHP to version 7.x
    This can be done for instance under CPanel > MultiPHP manager. If missing or you do not have access, ask your webhosting provider or another technical expert to do this for you.
     
  2. Turn off the PHP Filter module
    You need to double-check though that this format is not being used in any blocks or nodes
    Go to the module listing, disable or turn-off PHP Filter module
     
  3. Text Format hierarchy
    If for some reason the PHP format is needed and used (although the first option is the best recommendation as enabling PHP filtering is a security risk), place the PHP format above all other formats in precedence.
    Go to Configuration > Content Authoring > Text Formats
    Then drag PHP code text format above all other formats
    Save changes
Leave a Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Get reliable web hosting services

Recurring donation

Make Donation

  • Other: $

Donate now

Single donation

Make Donation

  • Other: $

Donate now