Jump to content

Recommended Posts

So, I had a technical interview for a job recently that was way over my head with what I have been used to doing procedural and basic OOP in PHP.

 

Some questions I got asked were on:

Caching

Compression

IDE for PHP - Eclipse? Netbeans?

Mootools

Codeigniter and Zend

Cross browser testing

Load balancing within PHP - is this SQL load balancing? I presumed any load balancing would be done by hardware or Linux.

 

Any ideas on some of these topics particularly compression? Also, I don;t really use an IDE, I use something called Bluefish and Kompozer.

I realise I have a lot of looking up to do as my PHP is ibviously way behind what the professional developers use.

Link to comment
https://forums.phpfreaks.com/topic/256887-technical-interview-compression/
Share on other sites

It doesn't look so much like "your PHP" is way behind, but rather you have yet to be exposed to technologies commonly used in the daily routine of a professional PHP developer.  Your best bet is to continue your individual research into those topics that you feel you're lacking understanding, as you know best what the technical interview was really asking (the short titles are very vague).

 

If you're looking for discussion here, could you elaborate on the subject a little? E.g. You mention "compression" but that covers a multitude of possible things that they could have been asking about, what was their question(s)?

It doesn't look so much like "your PHP" is way behind, but rather you have yet to be exposed to technologies commonly used in the daily routine of a professional PHP developer.  Your best bet is to continue your individual research into those topics that you feel you're lacking understanding, as you know best what the technical interview was really asking (the short titles are very vague).

 

If you're looking for discussion here, could you elaborate on the subject a little? E.g. You mention "compression" but that covers a multitude of possible things that they could have been asking about, what was their question(s)?

 

I think it was more to do with reducing the size of PHP scripts, eg one question was if I had a PHP script poduce a page of 1.5Mb, how could I make it smaller. I answered something about preloading images and buffering output. However, looking online, I saw some stuff about compressing the actual PHP script on the server side? Also, how can you cashe these scripts so they run quicker?

However, looking online, I saw some stuff about compressing the actual PHP script on the server side?

 

How big the PHP script file is does not really make much of any difference on execution time.  Obviously if it is generating a lot of output though, the end user has to download all that which depending on connection speed can take a while.  One way to help speed that up is to compress the output before sending it to the client.  Most browsers these days support gzip compression.  The data is sent from the server in a compressed format using the gzip algorithm and then the browser will automatically decompress it on it's end before displaying it to the user.  Compression works well on text, especially text that is repetitive so applying to HTML, JS, or CSS can reduce the amount of data being transferred significantly.

 

As for how to do this there are a few different ways.  Apache has an extension called mod_gzip which will automatically compress files if the browser requests it.  I've never used it so I'm not sure if it will handle output from PHP scripts as well or only static files.  Someone else or some google research could probably answer that for you.

 

PHP itself, if compile with gzip support, will allow you to compress it's output using a combiniation of output buffering (ob_start) and the handler function ob_gzhandler.  If you handle it through PHP though you need to take care that the client actually supports gzip otherwise they will get useless output.  Browsers that support it will indicate so via an additional header, Accept-Encoding I believe is the name.

 

Also, how can you cashe these scripts so they run quicker?

 

There exists some applications which will cache your PHP scripts (or arbitrary data your scripts may use often) in order to increase execution and access times.  For example memcached or APC.  Googling the terms php opcode cache could get you started on finding out more details

 

However, looking online, I saw some stuff about compressing the actual PHP script on the server side?

 

How big the PHP script file is does not really make much of any difference on execution time.  Obviously if it is generating a lot of output though, the end user has to download all that which depending on connection speed can take a while.  One way to help speed that up is to compress the output before sending it to the client.  Most browsers these days support gzip compression.  The data is sent from the server in a compressed format using the gzip algorithm and then the browser will automatically decompress it on it's end before displaying it to the user.  Compression works well on text, especially text that is repetitive so applying to HTML, JS, or CSS can reduce the amount of data being transferred significantly.

 

As for how to do this there are a few different ways.  Apache has an extension called mod_gzip which will automatically compress files if the browser requests it.  I've never used it so I'm not sure if it will handle output from PHP scripts as well or only static files.  Someone else or some google research could probably answer that for you.

 

PHP itself, if compile with gzip support, will allow you to compress it's output using a combiniation of output buffering (ob_start) and the handler function ob_gzhandler.  If you handle it through PHP though you need to take care that the client actually supports gzip otherwise they will get useless output.  Browsers that support it will indicate so via an additional header, Accept-Encoding I believe is the name.

 

Also, how can you cashe these scripts so they run quicker?

 

There exists some applications which will cache your PHP scripts (or arbitrary data your scripts may use often) in order to increase execution and access times.  For example memcached or APC.  Googling the terms php opcode cache could get you started on finding out more details

 

Are there tools that can be used to monitor the performance of PHP scripts and or load times of the HTML?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.