开发者

mysql and php: setting config variables on start - impact on server?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜