Search code examples
phpparsingosx-elcapitanrequire-once

Parse error: parse error in /Library/WebServer/Documents/website/includes/config.php on line 4


Since installing Mac OSX El Capitain, I am getting a parse error. The code works fine on the server, but on my development workstation, I get this error consistently.

Parse error: parse error in /Library/WebServer/Documents/website/includes/config.php on line 4

// Calling code snippet:

include("includes/navbar.php");
require_once("includes/config.php");

$servername = DBHOST;
$username = DBUSER;
$password = DBPASS;
$database = DBNAME;

config.php file:

<?php
/* Config File for Common Values */

define ("DBHOST", “127.0.0.1:3306”);  <--- This is line 4
define ("DBUSER", “userid”);
define ("DBPASS", “password”);
define ("DBNAME", “database”);

?>

Solution

  • You're using smart quotes ( and ) where you should have straight quotes ("). Replace the smart quotes with straight quotes. For example, change

    “127.0.0.1:3306”
    

    to

    "127.0.0.1:3306"
    

    Do the same with each of the other define() statements.