1

For some reasons, my site stopped responding today, Error

The www.mysite.com page isn’t working

www.mysite.com is currently unable to handle this request. HTTP ERROR 500

I understand there are many reasons for 500 error and it hard to know what exactly happend, I had a look into server log and notice this error

[Wed May 11 10:31:27 2016] [warn] [client x.y.z] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected 'return' (T_RETURN) in /var/www/vhosts/mysite.com/httpdocs/pro/includes/common.inc on line 5106.

Looking into common.inc

function drupal_json_encode($var) {
  // The PHP version cannot change within a request.
  static $php530;

  if (!isset($php530)) {
    $php530 = version_compare(PHP_VERSION, '5.3.0', '>=');
  }

  if ($php530) {
    // Encode <, >, ', &, and " using the json_encode() options parameter.
    return json_encode($var, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
  }

  // json_encode() escapes <, >, ', &, and " using its options parameter, but
  // does not support this parameter prior to PHP 5.3.0.  Use a helper instead.
  include_once DRUPAL_ROOT . '/includes/json-encode.inc';
  return drupal_json_encode_helper($var);
}

Line 5106 = return json_encode($var, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);

5
  • What happens if you remove the line above temporarily (the comment)? If this just "happened", without you changing anything, it'll be a change your host has made to the web server config
    – Clive
    May 11, 2016 at 10:21
  • try restarting apache
    – No Sssweat
    May 11, 2016 at 10:25
  • I think it would be more worrying if that fixed the problem @NoSssweat. If restarting apache fixes a syntax error, something's wrong elsewhere. It's probably a BOM issue in all honesty, these things usually are
    – Clive
    May 11, 2016 at 10:26
  • Try restarting your database server
    – Dev
    May 11, 2016 at 10:33
  • I commented the line still same problem and same complain :/. I am on shared hosting and i can't restart apache or database. I downloaded my site into my local server and it seems to be working. There is defiantly some problem with the hosting. I contacted them and waiting for reply.
    – Yama
    May 11, 2016 at 11:21

1 Answer 1

1

For some reason under PHP selector in Plesk dom and gd was disabled. after enabling those two the site return back to normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.