Sometimes you have large amount of generated data that you don’t want to create on every web request. An examples would be a home page with several news posts on it. The text would be in a database, but all the ‘extra’ things you did like bbtags present in the text, information about the user that posted it, etc etc [...]
Here we are, part 4b. By using XDebug, a pecl extension, our php code can be analyzed pinpointing the slower functions. Installing XDebug is easy: pecl install xdebug Now, you’ll have to enable it in the php.ini file: extension=xdebug.so xdebug.profiler_enable=1 xdebug.profiler_output_name=profiler-%s-%t.cache xdebug.profiler_output_dir=/tmp/xdebug Don’t forget to create the directory and give apache enough permissions to write in it. So after restarting [...]
Let me start by saying, I won’t bore you with the list of what I call stupid optimizations. That’s why I call this 4a, I recommend skipping 4a and go directly to 4b When I first when on my quest to optimize my code, I was disappointed at what I found. Let me give you a short list of ‘tips’ [...]
When using php scripts on the command line or in the cron, there are often times that you do not want to allow the same script to run more then once at a the same time. So a single instance application in php. Personally I use php scripts like this allot. My cron is filled with all kind of tasks [...]
Ever wanted to set your own session id? Well, I did. I was creating a webservice where authentication would be done with a ‘token’. This token would simply be a random guid given to that user after he logged on with his username/password. Now, this random guid/string would be the session ID. That way, if the user does an action [...]