views:

137

answers:

2

I had a Drupal installation at www.example.com/test. Now, it's ready to go live, and I am trying to move it to www.example.com. I changed the line in sites/default/settings.php to:

$base_url = 'http://www.example.com/';  // NO trailing slash!

When I navigate to my index.php, I get all sorts of parse errors, like this:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' 
in /home/example/public_html/sites/all/modules/typogrify/typogrify.class.php 
on line 18

The problem is this:

  public static function amp($text) {
    $amp_finder = "/(\s| )(&|&|&\#38;|&)(\s| )/";
    return preg_replace($amp_finder, '\\1<span class="amp">&amp;</span>\\3', $text);
  }

Every function like this is causing errors. then does PHP no longer understand this syntax that worked perfectly fine before in a subdirectory?

+3  A: 

IIRC, that is the error one got when trying to use visibility declarations (private/protected/public) in PHP 4. Could it be that your live environment uses a different PHP version than your testing environment?

While Drupal 6 core is supposed to still be compatible with PHP 4, many modules are not, as PHP 4 is not maintained anymore and does not get any security fixes since August 2008. Using it for a production site is therefore a big NO security wise.

So before investing any time in 'fixing' this, I'd recommend switching to PHP 5 immediately.

Probably unrelated to your problem, but did you read the comment on the line setting the $base_url variable? You should remove the trailing slash, in case you also have it there with your real URL.


Edit: Just checked the 'Typogrify' class from the offending file. It seems to be just a collection of static methods (functions). So if that is the only file giving you problems, you might be able to work around this by removing all the 'public' declarations in there, as they are not strictly necessary.

Note that I do not recommend this - you should not run a production site with a deprecated, unmaintained PHP version!)

Henrik Opel
+3  A: 
$base_url = 'http://www.example.com/';  // NO trailing slash!

NO trailing slash! ;)

codeinthehole
WOW. good for me.
Rosarch