Parse error: syntax error, unexpected

I just uploadd a site I amworking on, but get the following error:

Parse error: syntax error, unexpected ‘{’ in c:\domains\\wwwroot\includes\connect.php on line 3

Not just in the normal templates but in the connection file as well, which look like this:

  $pdo = new PDO('mysql:host=localhost;dbname=db_name',
catch (PDOException $e)
  echo 'Er is een database fout opgetreden.';
Offline it is working fine this way.

There’s nothing obvious there. I tried the code here on my localhost and it worked fine. Does it work OK if you just have the above code as a PHP file and call it up?

Off-the-wall suggestion … make the $pdo declaration as a single line. Perhaps there’s some config setting on your online server that doesn’t like that coding structure?

This is solved. On this particular server I needed to add the port to the PDO as well i.e.

  $pdo = new PDO('mysql:host=localhost;dbname=db_name;port=3351'   '$user',    '$pass');

That was all

This is strange, are you really sure this is how the problem is resolved?

+1, as that would not have solved a syntax error. You had to have something else going on too.

Try removing the single quotes around $user and $pass.

// from the PHP Manual

$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);

would it of mattered if it was EOL format i.e dos / unix