date_de开发者_开发百科fault_timezone_set('America/Guayaquil');
$cnn->execute('SET NAMES utf8');
$cnn->execute('SET GLOBAL time_zone = "-5:00"');
Hi, the code above is run everytime someone enters the website im developing. Does someone know what the impact (in performance) of those commands is?
Of the PHP date_default_timezone_set
command: negligible
Of the two MySQL commands: Unlikely to be significant.
Don't you mean SET SESSION
rather than SET GLOBAL
? If you're doing it for just the connection...
Edit: To expand on my answer, I have a script that gets included from just about every PHP script on my site that sets various configurations like date_default_timezone_set, starts sessions, defines functions and so on. It also sets the SQL mode to "TRADITIONAL" with the database connection. I think setting some configuration options is something you shouldn't try to avoid.
精彩评论