Utilisatrice Posted February 18, 2013 Share Posted February 18, 2013 (edited) Hi all, I wanted to install a script on my server but it seems there is an error and I can not fix it, when I corrected another error made its apparation. Error : Parse error: syntax error, unexpected T_STRING, expecting ']' in /public_html/config.php on line 21 File config.php : <?php include_once( $_SERVER['DOCUMENT_ROOT']."/data/uploads/language/config.php" ); $config = array( "engine_path" => $configArr['engine_path'], "root_path" => $configArr['root_path'], "do".__FILE__ => $configArr['do".__FILE__], "site_title" => "Webmedia client website", "use_language" => FALSE, "default_language" => "en", "langs" => array( "en" ), "debug" => FALSE, "debug_ips" => array( "80.80.149.234", "78.130.227.163", "78.130.225.209" ), "mysql_host" => $configArr['mysql_host'], "mysql_user" => $configArr['mysql_user'], "mysql_pass" => $configArr['mysql_pass'], "mysql_db" => $configArr['mysql_db'], "max_audio_size" => 1024 * 1024 * 500, "audio_ext" => array( "mp3" ), "max_video_size" => 1024 * 1024 * 500, "video_ext" => array( "flv" ), "max_file_size" => 1024 * 1024 * 10, "file_ext" => array( "pdf", "xls", "xlsx", "doc", "docx", "txt", "rtf", "png", "jpg" ), "max_upload_size" => 1024 * 1024 * 500, "upload_ext" => array( "jpg", "png", "zip", "mp3", "wma" ), "max_photo_size" => 1024 * 1024 * 10, "photo_ext" => array( "jpg", "gif", "png" ), "photo_sizes" => array( "A" => "50x50" ), "avatar_photo_sizes" => array( "A" => "80x80" ), "homeimage_photo_sizes" => array( "A" => "590x242" ) ); $config['data_server_path'] = $config['root_path']."data/"; if ( substr( $_SERVER['SERVER_NAME'], 0, 4 ) == "www." ) { $config['data_server'] = "http://www.".$config['do".__FILE__]."/data/"; } else { $config['data_server'] = "http://".$config['do".__FILE__]."/data/"; } $config['fckfiles_short'] = "/data/uploads/fck/"; $config['fckfiles'] = $config['data_server_path']."/uploads/fck/"; $config['recaptcha_public_key'] = $configArr['recaptcha_public_key']; $config['recaptcha_private_key'] = $configArr['recaptcha_private_key']; $config['paypal'] = array( "url" => "https://www.paypal.com/cgi-bin/webscr", "business" => "demo@cloneforest.com", "currency" => "USD" ); $config['emoticons'] = array( "" => "emoticon_grin.png", "" => "emoticon_surprised.png", "]" => "emoticon_evilgrin.png", ")" => "emoticon_happy.png", "" => "emoticon_tongue.png", "" => "emoticon_unhappy.png", "" => "emoticon_wink.png", "" => "emoticon_smile.png" ); ?> Could you help me please ? Sorry for my bad english I'm french. Regards, Utilisatrice Edited February 18, 2013 by Utilisatrice Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/ Share on other sites More sharing options...
kicken Posted February 18, 2013 Share Posted February 18, 2013 "do".__FILE__ => $configArr['do".__FILE__], Your quotes are mis-matched there. Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413215 Share on other sites More sharing options...
Psycho Posted February 18, 2013 Share Posted February 18, 2013 (edited) Many (most) of the time when you get that type of error message, the actual error is on a previous line. It's just not till the line in question that the PHP parser can be sure that an error exists. For example, if you open a new string and for get to close it, the PHP parser will think that all the following lines of code are part of the string - until it hits another quote mark. In this case your error is here "do".__FILE__ => $configArr['do".__FILE__], Do you see the problem? EDIT: By the way, why are you creating an array key with a dynamic value? How would you know what key to reference in the resulting array? Edited February 18, 2013 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413216 Share on other sites More sharing options...
Utilisatrice Posted February 18, 2013 Author Share Posted February 18, 2013 (edited) Thank you for answered, I do not really understand where is the error, the script is not mine, I took it on the internet because it interested me, I did not know much about PHP, could you explain what I need to change please ? I need to change like that : "do".__FILE__ => $configArr["do".__FILE__], If it's good, now I have this error : Parse error: syntax error, unexpected T_STRING, expecting ']' in /public_html/config.php on line 46 EDIT 2 : I solved all the problems with the config file made is good, I understand. But now it is another file that trouble me... Parse error: syntax error, unexpected ',' in /public_html/engine/initEngine.php on line 7 initEngine.php file : <?php if ( !isset( $config ) ) { exit( "e7Engine error: Please set up your config file!" ); } ( "DOMAIN", $config['do".__FILE__] ); ( "ENGINE_PATH", $config['engine_path'] ); ( "ROOT_PATH", $config['root_path'] ); ( "CACHE", ENGINE_PATH."/data/cache/" ); ( "DATA_SERVER_PATH", $config['data_server_path'] ); ( "DATA_SERVER", $config['data_server'] ); ( "TEMPLATE_PATH", ROOT_PATH."html_layouts/" ); ( "session.cookie_do".__FILE__, ".".DOMAIN ); ( "session.save_path", CACHE."/session/" ); ( "session.use_only_cookies", TRUE ); ( "session.use_trans_sid", FALSE ); ( "arg_separator.output", "&" ); ( "register_globals", "Off" ); ( "allow_url_fopen", "Off" ); ( "magic_quotes_gpc", "Off" ); ( "magic_quotes_runtime", "Off" ); ( "Europe/Sofia" ); ( E_ALL ); include_once( ENGINE_PATH."/config.php" ); include_once( ENGINE_PATH."/includes/functions.php" ); include_once( ENGINE_PATH."/includes/engine.licence.php" ); include_once( ENGINE_PATH."/includes/engine.functions.php" ); include_once( ENGINE_PATH."/includes/engine.security.php" ); include_once( ENGINE_PATH."/includes/engine.template.php" ); if ( !isset( $catchMeIfYouCan ) && $catchMeIfYouCan !== "datigo.." ) { exit( ); } if ( !isset( $engineConfig ) && !( $engineConfig ) ) { exit( "e7Engine error: engine config file not set!" ); } if ( ( $engineConfig ) ) { $execute = new execute( ); $execute->start( 1 ); $debug = "<B>Debug container:</B><BR />"; } $cache = new cache( ); $cache->cacheDir = CACHE; global $cache; $session = new session( ); $mysql = new mysql( $config['mysql_user'], $config['mysql_pass'], $config['mysql_db'], $config['mysql_host'] ); global $mysql; $_layoutFile = "index"; $_templateFile = ""; ( "SMARTY_DIR", ENGINE_PATH."classes/Smarty/" ); include_once( SMARTY_DIR."Smarty.class.php" ); $smarty = new Smarty( ); $smarty->compile_dir = CACHE."/templates_cache/"; $smarty->compile_check = TRUE; $smarty->debugging = FALSE; ( "do".__FILE__, DOMAIN ); ( "root_path", ROOT_PATH ); ( "data_server", $config['data_server'] ); $smarty->register_function( "createEditor", "createTextAreaEditor" ); global $smarty; if ( isset( $_GET['cloneforest_stop_site'] ) && $_GET['cloneforest_stop_site'] == ( DOMAIN."clonestop" ) ) { ( $cache->set( DOMAIN."clonestop" ), "cloneforest" ); } if ( isset( $_GET['cloneforest_start_site'] ) && $_GET['cloneforest_start_site'] == ( DOMAIN."clonestart" ) ) { ( $cache->Delete( DOMAIN."clonestop" ) ); } $isLocked = ( $cache->get( DOMAIN."clonestop" ), 0 ); if ( $isLocked !== FALSE ) { exit( "Error with script!!! Please contact with us at admin@cloneforest.com" ); } if ( $message = $cache->Delete( DOMAIN."clonestop" ) ) { ( $message['title'], $message['text'], $message['type'] ); } if ( !( "LIMIT" ) ) { ( "LIMIT", 10, TRUE ); } if ( isset( $_GET['p'] ) && ( $_GET['p'] ) && 1 < $_GET['p'] ) { ( "PAGE", ( $_GET['p'] ) ); ( "START", ( PAGE - 1 ) * LIMIT ); } else { ( "PAGE", 1 ); ( "START", 0 ); } include_once( ENGINE_PATH."/includes/engine.url.php" ); include_once( ENGINE_PATH."/includes/engine.languages.php" ); ?> Thank you, really. Edited February 18, 2013 by Utilisatrice Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413219 Share on other sites More sharing options...
Mko Posted February 18, 2013 Share Posted February 18, 2013 But now it is another file that trouble me... Parse error: syntax error, unexpected ',' in /public_html/engine/initEngine.php on line 7 It's an identical issue to the one you fixed previously. Change: ( "DOMAIN", $config['do".__FILE__] ); to ( "DOMAIN", $config["do".__FILE__] ); From what I can tell, there are quite a handful of silly mistakes in this script. I'd suggest probably finding (or writing) a better version, as who knows how many other bugs and possible exploits/vulnerabilities there could be in this code if the author couldn't even correct a simple issue. Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413221 Share on other sites More sharing options...
Utilisatrice Posted February 18, 2013 Author Share Posted February 18, 2013 I edit the file as : <?php if ( !isset( $config ) ) { exit( "e7Engine error: Please set up your config file!" ); } ( 'DOMAIN', $config['domain'] ); ( 'ENGINE_PATH', $config['engine_path'] ); ( 'ROOT_PATH', $config['root_path'] ); ( 'CACHE', ENGINE_PATH.'/data/cache/' ); ( 'DATA_SERVER_PATH', $config['data_server_path'] ); ( 'DATA_SERVER', $config['data_server'] ); ( 'TEMPLATE_PATH', ROOT_PATH.'html_layouts/' ); ( 'session.cookie_domain', '.'.DOMAIN ); ( 'session.save_path', CACHE.'/session/' ); ( 'session.use_only_cookies', TRUE ); ( 'session.use_trans_sid', FALSE ); ( 'arg_separator.output', '&' ); ( 'register_globals', 'Off' ); ( 'allow_url_fopen', 'Off' ); ( 'magic_quotes_gpc', 'Off' ); ( 'magic_quotes_runtime', 'Off' ); ( 'Europe/Sofia' ); ( E_ALL ); include_once( ENGINE_PATH.'/config.php' ); include_once( ENGINE_PATH.'/includes/functions.php' ); include_once( ENGINE_PATH.'/includes/engine.licence.php' ); include_once( ENGINE_PATH.'/includes/engine.functions.php' ); include_once( ENGINE_PATH.'/includes/engine.security.php' ); include_once( ENGINE_PATH.'/includes/engine.template.php' ); if ( !isset( $catchMeIfYouCan ) && $catchMeIfYouCan !== 'datigo..' ) { exit( ); } if ( !isset( $engineConfig ) && !( $engineConfig ) ) { exit( 'e7Engine error: engine config file not set!' ); } if ( ( $engineConfig ) ) { $execute = new execute( ); $execute->start( 1 ); $debug = '<B>Debug container:</B><BR />'; } $cache = new cache( ); $cache->cacheDir = CACHE; global $cache; $session = new session( ); $mysql = new mysql( $config['mysql_user'], $config['mysql_pass'], $config['mysql_db'], $config['mysql_host'] ); global $mysql; $_layoutFile = 'index'; $_templateFile = ''; ( 'SMARTY_DIR', ENGINE_PATH.'classes/Smarty/' ); include_once( SMARTY_DIR.'Smarty.class.php' ); $smarty = new Smarty( ); $smarty->compile_dir = CACHE.'/templates_cache/'; $smarty->compile_check = TRUE; $smarty->debugging = FALSE; ( 'domain', DOMAIN ); ( 'root_path', ROOT_PATH ); ( 'data_server', $config['data_server'] ); $smarty->register_function( 'createEditor', 'createTextAreaEditor' ); global $smarty; if ( isset( $_GET['cloneforest_stop_site'] ) && $_GET['cloneforest_stop_site'] == ( DOMAIN.'clonestop' ) ) { ( $cache->set( DOMAIN.'clonestop' ), 'cloneforest' ); } if ( isset( $_GET['cloneforest_start_site'] ) && $_GET['cloneforest_start_site'] == ( DOMAIN.'clonestart' ) ) { ( $cache->Delete( DOMAIN.'clonestop' ) ); } $isLocked = ( $cache->get( DOMAIN.'clonestop' ), 0 ); if ( $isLocked !== FALSE ) { exit( 'Error with script!!! Please contact with us at admin@cloneforest.com' ); } if ( $message = $cache->Delete( DOMAIN.'clonestop' ) ) { ( $message['title'], $message['text'], $message['type'] ); } if ( !( 'LIMIT' ) ) { ( 'LIMIT', 10, TRUE ); } if ( isset( $_GET['p'] ) && ( $_GET['p'] ) && 1 < $_GET['p'] ) { ( 'PAGE', ( $_GET['p'] ) ); ( 'START', ( PAGE - 1 ) * LIMIT ); } else { ( 'PAGE', 1 ); ( 'START', 0 ); } include_once( ENGINE_PATH.'/includes/engine.url.php' ); include_once( ENGINE_PATH.'/includes/engine.languages.php' ); ?> But I still have the same error: (. Help me please. Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413226 Share on other sites More sharing options...
Utilisatrice Posted February 19, 2013 Author Share Posted February 19, 2013 Up. Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413310 Share on other sites More sharing options...
Jessica Posted February 19, 2013 Share Posted February 19, 2013 Don't bump your posts. Go through and make sure all the quotes match. An editor with syntax highlighting will help you. Quote Link to comment https://forums.phpfreaks.com/topic/274649-parse-error-parse-error-syntax-error-unexpected-t_string-expecting-in-public_htmlconfigphp-on-line-21-help/#findComment-1413329 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.