SQL
A simple tale of SQL Injection .....
Submitted by David Goodwin on Fri, 16/05/2008 - 21:24.Today, I was giving a one-on-one PHP training course covering databases (we were trying to get mssql to work with PHP on Windows, but various factors seemed to conspire against us - possibly permissions related, as it seemed to refuse to allow us to select from a table that fricking well did exist.). Anyway, the amusing story was.....
MySQL - MyISAM tables and large index (.myi) files
Submitted by David Goodwin on Tue, 22/04/2008 - 12:34.This is just a quick note, incase it helps someone else in the future.
It seems that MySQL server, when using MyISAM tables doesn't truncate the index file when you run "ALTER TABLE x DISABLE KEYS", so when running "ALTER TABLE x ENABLE KEYS" you end up with an MyISAM index file (xxxx.myi) which keeps growing. In my case this hit 90gb on a customer's server.
Ways to fix this :
- Upgrade to MySQL 5.0.52 (apparently ... see
http://bugs.mysql.com/bug.php?id=4692 ) - Run "optimize table xxxx"
UKUUG 2008 Spring Conference with added PostgreSQL
Submitted by David Goodwin on Mon, 11/02/2008 - 22:51.The 2008 UKUUG Spring conference is coming up soon (well, 31st March to 2nd April). It's focus is large scale systems admin, but some of the talks look appealing to a wider audience (e.g. anti-spam). The good news is that it's in Birmingham, which seems to be attracting a few more technical events lately :)
Release: Pale Purple's Trac Project Planning Board
Submitted by kat on Thu, 01/11/2007 - 11:20.More training courses
Submitted by kat on Tue, 09/10/2007 - 10:37.We've scheduled some more PHP training courses up to June next year, running monthly.
People who are active members of Birmingham, Wolverhampton or Redditch and Bromsgrove LUGs or PHPWM can receive a discount of £25/day
See here for more details
MySQL Query Optimisation
Submitted by David Goodwin on Thu, 31/05/2007 - 17:38.Intro
Some notes on MySQL (v4.1.13) optimization where I managed to reduce the time of performing a task from 1 hour to 9.4 minutes.
Background
While working for one customer, a task I had was to consolidate (mergE) data from a number of separate databases into one. This involved importing a relatively large quantity of data into a central MySQL database.
How to use PHP and PEAR MDB2 (Tutorial)
Submitted by David Goodwin on Wed, 23/05/2007 - 09:52.While writing some PHP Training materials for Pale Purple, I thought I'd add an updated guide on PHP and database access. I've already done one on PEAR::DB, but PEAR::MDB2 is it's successor and has a slightly different API.... and as PEAR::DB is now deprecated, it's probably about time I rewrote it anyway.
postfixadmin squirrelmail plugin (with added PostgreSQL support)
Submitted by David Goodwin on Thu, 08/03/2007 - 14:25.Postfixadmin Squirrelmail plugin
I found a Squirrelmail plugin for Postfixadmin the other day on Sourceforge. It provides support for setting vacation/auto-response messages, adding aliases/forwards and changing your password.
Unfortunately it didn't support PostgreSQL, and as we later found out, it was full of SQL injection holes....
PHP5 and Propel
Submitted by David Goodwin on Mon, 19/06/2006 - 21:12.PHP5, Propel and Smarty
Currently we're working on a large (well, I think it is) project to build a web based events management system. We've chosen to use a combination of Propel, PHP5 and Smarty to build the application. Here's a really quick round up of what we've discovered so far:
- Propel rocks - not having to write an SQL database schema, or write SQL for simple actions is great (it does also allow you to write SQL if you need to for more complex queries).
- Propel rocks - it's database agnostic... so changing backend should be easy.
- Propel has a build phase where it reads schema.xml, creates a load of PHP5 object files (which you use to interact with the database) and then sets up the database structure for you... this on it's own removes a large chunk of my work.Propel allows you to define validation rules on fields - they're easy to check against, and after integrating them with Smarty we have automatic form field validation and good feedback for users.
- PHP5's reflection support has proved invaluable.
- Smarty was giving me problems with it's output modifiers - I hoped I could use the 'escape:"htmlall"' string to sanitise all output - unfortunately this didn't seem to work with objects (at least embedding
{$myobject->getMethod()}within a template), so I've had to override the$smarty->assign()function to sanitise objects as well as other variables. - I think I've got to the point where I can automate all the code necessary to add/update/view a particular record, to the extent that I'll need to write a Smarty template file, and about 3-10 lines of PHP behind the scenes to plug it into Propel (this does of course rely on libraries I've already written). This is good.
So full steam ahead! I'll probably write this up in far more depth either as a Linux User article, or on here, or both.
PHP5 and PDO
Submitted by David Goodwin on Wed, 17/05/2006 - 13:04.PHP5 and PDO
For some time now, we've been using PEAR::DB to do any database stuff from within PHP scripts. It's attraction was the ease of changing from one database to another. After I wrote a little about it here I had a few comments regarding performance. After the last phpwm user group meeting, I thought I'd better try and give PDO a go (thanks to Rob) as it appeared to provide a uniform cross platform, cross database method of accessing data. This details my initial findings. (PDO probably requires PHP5).
Recent comments
3 days 13 hours ago
1 week 15 hours ago
1 week 3 days ago
1 week 3 days ago
1 week 4 days ago
1 week 4 days ago
1 week 6 days ago
2 weeks 6 hours ago
2 weeks 9 hours ago
2 weeks 11 hours ago