Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php slow lag when login

i am developing a new section on my site and ive notice a small latency when login. on my computer it works great but when i put it to th eserver it is slower. the login process is slower on the server and not on my cmoputer.

half second to 1 second slower

i have doubt on my hosting that is not as fast as they say since on my computer its fast.

is there a way i can monitor the speed of the server command line or php script i can run to find out what's wrong?

like image 984
Owan Avatar asked Feb 11 '12 03:02

Owan


1 Answers

Put these three lines of code in various places in your script (replacing "foo" with a description of where you place it in the code):

$h = fopen('log.txt', 'a');
fwrite($h, 'foo: ' . microtime(true));
fclose();

Then, run your script, and you can see which part is slow.

like image 94
Abhi Beckert Avatar answered Nov 02 '22 12:11

Abhi Beckert