Php Blog

Configure XDebug with PuPHPet, Vagrant, Apache, Ubuntu, PHP-FPM and PhpStorm
Last edited on: 21/06/2015 - 10:07

PuPHPet is a terrific GUI to set up virtual machines for Web development and will build your orchestration script with Vagrant and Puppet. It now comes with a facility to include XDebug in your Vagrantfile meaning there is no longer an excuse for print_r() and error_log() debug traces in your code.

»   Read more
openSUSE 12.3 Installation of GitLab, Nginx, Apache and Drupal PHP
Last edited on: 02/10/2013 - 09:46

This tutorial blog is intended for those who wish to run concurrent instances of Nginx and Apache web servers on Linux openSUSE 12.3, the Nginx server being used for the Ruby on Rails GitLab application, whilst Apache will co-exist for serving pages from my PHP-based Drupal sites. Of course, the exercise is valid for Wordpress and Joomla and other PHP-based CMS frameworks.

»   Read more
PHP Download Twitter Friends and Follow Back
Last edited on: 19/04/2013 - 19:10

This continues my earlier tutorial PHP Download Twitter Followers and Save in MySQL Database by providing the functionality to:

  1. Download an account's friends and save this into a MySQL database
  2. Provide a discrepancy check between this list and the followers list, and delete all friends that are not also following
  3. Provide a discrepancy check between followers and friends, and follow back all those the account is not currently following
»   Read more
PHP Download Twitter Followers and Save in MySQL Database
Last edited on: 16/04/2013 - 21:34

Regular readers will know I created a TwitterBot and documented it here. The biggest problems with the system which retweets according to search criteria are two-fold:

  1. It can be hijacked by the malicious / nefarious for sending off-message tweets to the entire follower base
»   Read more
PHP Retweeting Twitter Bot Using Streaming API Search Results
Last edited on: 16/04/2013 - 21:00

The introduction of the Twitter Streaming API now provides the Twitter developer with an accurate method of obtaining real-time search results. Previously the developer would have had to use the existing REST service which is not guaranteed to provide either timely or thorough results. The new Streaming API can be used with basic authentication based on an existing account, whilst the REST API requires the more complex OAuth method of authentication.

Armed with this knowledge I decided to develop a Twitter Bot with the following functionality:

»   Read more
Drupal 7 - User Restrictions Batch Module
Last edited on: 04/03/2013 - 17:59

This module extends the existing user_restrictions module by providing a mechanism for the bulk import of prohibited words in the screen name during user registration. This is useful to ensure that on a community site no users attempt to create accounts with offensive names. Without this module, any admin wishing to add a few hundred words to the user_restrictions list would face quite an onerous chore to type them all in. With the module, they can be cut and pasted from an existing source into a textarea in one go.

»   Read more
Configuration for openSUSE 12.1, Drupal and Nginx
Last edited on: 24/12/2012 - 13:07

This tutorial is intended for those planning on removing Apache as their Drupal web server, and replacing it with the high performance NGINX product (pronounced Engine-X) on an openSUSE 12.1 platform. Note, this is using Nginx as the web server itself, and not as a reverse proxy as it is often used. Firstly, there is a need to install Nginx and PHP-FPM (the PHP FastCGI Process Manager).

Nginx is part of the openSUSE 12.1 distribution, but is not installed by default. The simplest way of installation is to go through the YaST software management screens.

»   Read more
Drupal 6: user_badges_taxonomy Module
Last edited on: 15/01/2012 - 22:23

The motivation for this module came from a shortcoming of the functionality of the user_badges module and the thread http://drupal.org/node/1144296 questioning the usage of the vocabulary feature in the user_badges module. It appears that this enables the assignment of badges to users for arbitrary achievements. For instance, a client of mine is a political campaigning organisation and it would be cool to assign badges to those activists who attend campaigns.

»   Read more
PHP Algorithm to Evenly Distribute Items into 3 Columns
Last edited on: 09/11/2010 - 15:27

This is the second time in my PHP career I've needed this so thought I'd commit it to a blog for easy access next time and save myself some brain MIPS. I want to evenly distribute items into three piles, making sure that no pile can have more than 1 extra item, and should a pile need 1 more than the other piles, then the item should go to the left-most first. This is better explained by way of a diagram. My pile of items is shown as letters of the alphabet.

A A
AB A,B
ABC A,B,C
ABCD AB,C,D
ABCDE AB,CD,E
ABCDEF AB,CD,EF
ABCDEFG ABC,DE,FG
ABCDEFGH ABC,DEF,GH
ABCDEFGHI ABC,DEF,GHI

»   Read more
PHP Convert Decimal UK Currency To Pounds Shillings Pence
Last edited on: 02/11/2010 - 09:49

I came across an unusual problem the other day. Whilst developing a PHP book / magazine cataloguing system I wanted to output the cover prices of the items that were pre-decimalisation (1971) in the old UK pounds / shillings / pence format.

For a reminder, particularly for those born later than the mid sixties who will have no recollection of the olden days, the British currency had 12 pennies (d) to the shilling [s] and there were 20 shillings to the pound (£). That makes a total of 240 pennies in a pound.

»   Read more
Syndicate content