Function Posted January 13, 2012 Share Posted January 13, 2012 I have this error to resolve to be compatible with PHP 5.3: Parse error: syntax error, unexpected '.', expecting '(' in/includes/counter.php on line 27 Code Line 27 is: $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, function.mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4))); Appreciate any help! Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/ Share on other sites More sharing options...
Muddy_Funster Posted January 13, 2012 Share Posted January 13, 2012 it's not function.mktime, it's just mktime Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307428 Share on other sites More sharing options...
Function Posted January 14, 2012 Author Share Posted January 14, 2012 Thanks! I removed the function. and now this warning appeared: Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /includes/counter.php on line 27 Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307443 Share on other sites More sharing options...
Muddy_Funster Posted January 14, 2012 Share Posted January 14, 2012 yip, that will happen if you don't have the default time zone set in the php.ini file. Yuocan set it during runtime using the date_default_timezone_set('country/area'); function at the top of your page. See here for a list of timezones to use -> http://www.php.net/manual/en/timezones.php Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307445 Share on other sites More sharing options...
Function Posted January 14, 2012 Author Share Posted January 14, 2012 Could you elaborate more about this fix. I'm fairly new to PHP. where would i find the php.ini code file? And just insert my area like: Canada/Eastern Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307458 Share on other sites More sharing options...
BlueSkyIS Posted January 14, 2012 Share Posted January 14, 2012 the way i find php.ini is to run phpinfo() on the command line: php -r 'phpinfo();' or if you're running a php page: <?php phpinfo(); ?> One of the pieces of information listed is the location of php.ini Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307479 Share on other sites More sharing options...
jcbones Posted January 14, 2012 Share Posted January 14, 2012 You should also look up the default timezone in the manual, so you can input a correct timezone. They are listed there. Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307587 Share on other sites More sharing options...
Function Posted January 14, 2012 Author Share Posted January 14, 2012 I need to put in Canada/Eastern What is the code and do I put it in the php.ini file? There's not much in this file. It only states: register_globals = On That's all that's in the code. Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307669 Share on other sites More sharing options...
AyKay47 Posted January 14, 2012 Share Posted January 14, 2012 Thanks! I removed the function. and now this warning appeared: Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /includes/counter.php on line 27 I need to put in Canada/Eastern What is the code and do I put it in the php.ini file? There's not much in this file. It only states: register_globals = On That's all that's in the code. depends, do you want the change to affect every page or just one? just one: use the php function in the error, else use the php.ini directive. Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307670 Share on other sites More sharing options...
jcbones Posted January 14, 2012 Share Posted January 14, 2012 I need to put in Canada/Eastern What is the code and do I put it in the php.ini file? There's not much in this file. It only states: register_globals = On That's all that's in the code. If you care to look at the manual, you will see at the bottom of the "others" page, the one with Canada/Eastern on it. There is a warning. Warning Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons. Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307711 Share on other sites More sharing options...
Function Posted January 15, 2012 Author Share Posted January 15, 2012 I'm sorry! I'm fairly new to PHP and don't know what your talking about. I must seem like a dummy. This is the code I put in the only php.ini file I could find and the code file is right up near the top. register_globals = On // US TimeZones according to DateTime's official "List of Supported Timezones" $aTimeZones = array( 'America/New_York'=>'EDT', ); ?> It did not remove the error: Warning: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /includes/modules/new_products.php on line 16 If you can help please tell me if that is right code and where am I to place it? Or what is the right code? I did read that You can set a default time zone for your server from the configuration file (php.ini) at the line: [Date] ; Defines the default timezone used by the date functions date.timezone = America/New_York I could not find a line that started with [Date] Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307717 Share on other sites More sharing options...
Muddy_Funster Posted January 15, 2012 Share Posted January 15, 2012 it's the first line in modue settings on mine: ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;; [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Europe/London if it is not in the modue settings of your php.ini file you could try adding it. Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307722 Share on other sites More sharing options...
AyKay47 Posted January 15, 2012 Share Posted January 15, 2012 more than likely its a custom php.ini for the server, the directive will need to be added. Quote Link to comment https://forums.phpfreaks.com/topic/254981-could-nayone-help-with-this-parse-error-syntax-error/#findComment-1307726 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.