Earlier in the year I was part of the team that put live a new site for my employer, moving from a predominately flat HTML site with a little PHP to one using Drupal 7. Here I will go through some of the issues that have been encountered around performance and the steps that I lead to improve site performance over time and as new features have been added.
Please note this is not my site so at times I don’t go into lots of detail around numbers.
Continue reading
Tag: apache
It has been over 5 years now since I went and sent up a company so I could work for myself. In that time it has ranged from very lean to actually having to say no to work. There was a short detour back to perm work but in reality their painted picture was better than reality.
Lack of clear direction
One mistake I can readily admit over these years is a lack of clear direction. At times the business has been part:
- Full service web company
- Hired gun contractor / freelancer inside other organisations
- Web site content with income from advertising
- Web site services with pay for use
Number 2 has been by far the most successful in a monetary sense with the others suffering from being a small fish in a big wide sea. This is not to say the time spent on them has been wasted. I have learnt a lot about business models, promotion & marketing amongst other non technical skills. But it did have me wearing too many hats, and results suffered because of this.
Current Focus
Over the last 6 months I have consciously been moving to a situation where the company structure is purely to support my freelance software development. No more trying to build the next big thing by myself or compete for small fry work from small companies where the dollar cost seems more important than the benefit that can be derived from their web presence.
The core skills are still developing in a Linux / Apache / MySQL / PHP environment. Working with customising WordPress as a CMS has become much more prevalent, and I have been putting effort into taking my front end web skills around javascript and jQuery to another level. I still like to use my skills working with relational databases.
For the Future
A few ideas for the future.
- Finding & working with other skilled professionals on a project by project basis. Whether they be a project manager, graphic designer, marketer or other developers.
- Writing more here and sharing some of what I have leant from a technical perspective.
- Releasing more code when I am in a legal position to do so under a free license. I have lots of custom WordPress plugins and modifications to other plugins that others should find useful.
- Understand more about non relational databases
- Learn and do more development for mobile platforms
With the Apache web server, I set a server wide directive of which environment the server is in, eg. production, test or dev, using the SetEnv directive. In a PHP script I can pick up this value, and set on all debugging in dev, or suppression in production. Having it set 1 place in Apache means I don’t need to hard code the environment in any PHP code, making movement of code between environments cleaner.
Recently I have begun to use Nginx as the web server with PHP fastcgi for a project, and was looking for a similar set up. The answer I have come up with is an additional entry in my fastcgi_params file. The exact name & location of this file may be different for you. Mine is located at /etc/nginx/fastcgi_params.
fastcgi_param SYS_ENV dev;
This way in my bootstrap script I can have the following code:
if ($_SERVER['SYS_ENV'] === 'production') { date_default_timezone_set('America/Los_Angeles'); } else { // Test and dev error_reporting(E_ALL|E_STRICT); date_default_timezone_set('Australia/Sydney'); ini_set('display_errors','On'); }
There is probably another way to do this with Nginx, and I would be happy to hear it, as I try and improve my Nginx knowledge.
If you are looking to create dynamic functionality on a web site, there are no shortage of options for the server programming language. So why use PHP?
I had occasion to set up a dev box to test a new web application against different php versions, so I thought I would share the steps. This setup is for one PHP version at a time, and I have documented for 2 versions, but more can be done if required. Also I have used PHP4 and 5, but it could be multiple versions of PHP5, such as a beta version of 5.3. This setup was done using Apache2 on Windows.
Recently I was involved in a project that returned graphic thumbnails in response to a remote php script call. One of the optimisations done was to have browser caching of returned images to save on our bandwidth. I will share the code we used to do this.