Recently I noticed a few of my servers had stopped serving my sites, withย 502 errors being to visitors. I took a look at my site logs and noticed that they were full of the “Permission Denied” errors below: 2014/06/09 09:45:17 [crit] 11453#0: *22 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission…
Read MoreTracing Email Sending PHP Scripts On Servers
It happens sometimes, a server you are responsible for seems to be sending out spammy emails, and its normally caused by legacy or insecure code. The mail log indicates there are plenty of potential spam messages going out that are originating locally but most Linux servers host a lot of…
Read MoreExecuting PHP Code Server Side In .html Files
On a recent project we needed to provide a client our contribution to the site code base as static .html files. To make the development process easier though a number of the developers wanted to include some of the global page assets such as the header and footer using PHP…
Read MoreEasy PHP File Extensions With PathInfo
The other day I was building some file handling functionality into a project I was working on when i came to thinking about the best way to retrieve the extension of a filename with PHP. The first approach that came to mind was using explode statement to split the string…
Read MorePHP CGI 504 Gateway Timed Out Errors With Nginx
Recently I noticed that the nginx error log for a site I was working with was filling up with timeout messages similar to below: 2012/07/06 17:21:01 [error] 23897#0: *8870 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 173.25.1.129, server: project.com, request: “GET /jobs/update HTTP/1.0”,…
Read MoreCurrency Conversion With Google Calculator
Working on a recent project I found myself in the market for a way to simply calculate what one currency is worth in relation to another. After some looking around I was surprised to find currency conversion can be performed quickly and simply using the Google Calculator API. To use…
Read MoreMagic Quotes In PHP
The Symptoms Recently I was trying to debug a piece of code it worked fine in the development and staging environments. But when the code was uploaded to the production server it would break! Looking at the JSON data it appeared the production web server was adding back slashes to…
Read MoreUsing The Panoramio Wrapper Class
Ever been working on a project that was area specific and wanted nearby local images? I did recently, and knew after seeing images over layed onto Google maps that it must be possible. Looking around I found a few pieces of code that did what I wanted using the Panoramio…
Read MoreMagic constant not working with require_once
Its funny when a new feature is added to your language of choice how quickly it gets embraced and used within your code. Today upon uploading some code to a clients shared hosting environment I was greeted by the following error: Uploading a file to display phpinfo() I was able…
Read MoreAnonymizing CURL Scripts With TOR & Polipo
Last week I received a typical run of the mill phishing email littered with the usual bad Engrish making the instructions far from believable but being bored I decided to take a look at the link they were pushing. They had created a believable enough looking Paypal form asking clueless…
Read More