Parse error: syntax error, unexpected '=' in /var/somepath.../../ee/system/expressionengine/libraries/Functions.php(679) : eval()'d code on line 3

I get this error if I embed a a template.

I tried exit(0) at all the partitions below ,but it still gives me the same error.I tried exiting at the first line too,but I face the same problem.The code works only when the embed is removed.My php stage is output.


ini_set('error_reporting', E_ALL |  E_STRICT);
error_reporting(E_ALL | E_STRICT);
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
//True modified date - sent to header
$last_modified = gmdate('D, d M Y H:i:s T', getlastmod());
$SERVER_ROOT = '/var/www/projects/tensports/htdocs/tsport/';

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: $last_modified GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

define("BASE_URL", "http://www.tensports.com/");

//include_once $SERVER_ROOT.'/include/cookie.php';
include_once $SERVER_ROOT.'/classes/DB.class.php';

//for all the constant variables
$STATIC_URL = 'http://www.tensports.com/';
$MOB_STATIC_URL = 'http://www.tensports.com/mobile';
$COOKIE_DOMAIN_PATH = '.tensports.com';
$SOURCE_COOKIE_NAME = 'tensports_source';
$APPLICATION_ROOT = '/var/www/projects/tensports/htdocs/tsport';
$from_status = array("Sent","Not Accepted","From Accepted","From Rejected");
$to_status = array("Not Responded","To Accepted","To Rejected");

//$DEFAULT_PIC = $CDN_URL."images/profile-pic-def.jpg";

include_once $SERVER_ROOT.'/include/social_plugins.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/include/constants.php';
//include_once $SERVER_ROOT.'/config/country-redirect.php';
include_once $SERVER_ROOT.'/classes/Main.class.php';

define("PAGE_LIMIT", 10);
$host = "";
$user = "tensports"; //"stensportsadmin";
$pwd  = "fd48a6aac21cfe4555f44e0e68daf805"; //"r7QMB$#ZnCV&mG";
$db   = "tensports"; //"staging_tensports_db";
$country = "";
$mysql = new DB();//DB Class


    $mysql->Connect($host, $user, $pwd, $db);
}catch( Exception $e){

error_log($mysql->Connect($host, $user, $pwd, $db));
$main = new Main($mysql);//Main class
$currDate       =   date('Y-m-d');
$currDateTime   =   date('Y-m-d H:i:s');
$currTime       =   date('g:i A');
  • you don't see php error, but you must have it in you error log. Did you check it? – Max Lazar Feb 26 '14 at 8:24

This one's not worth tracking down the root of to be honest -- this is most definitely not what embeds are for, and I'm not surprised you're hitting an error when trying to load this giant hunk of PHP as an embed.

My advice is to work with ExpressionEngine, not against it by cramming dozens of lines of PHP into a template. I'd look at moving your custom code into extensions and plugins/modules as required. Start by reviewing EE's developer documentation.

  • I agree, and there are plugins to handle cookie modification and sessions. Also have you enabled php on those templates? – Johnathan Waters Feb 26 '14 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy