If for some reason you’ve powered on and while Apache seems to be running OK, lighttp isn’t (for example phpMyAdmin isn’t working on localhost:10081/phpmyadmin) then you will need to start it manually. This is probably caused by a dirty restart, such as a power failure. On Mac OS X run this command… sudo /usr/local/zend/bin/lighttpdctl.sh start For Windows, I’m...
Zend Framework 1.8+ Module/Library Autoloading
Given the problems I had for the 1st Zend Framework website I did, I figured the next time I started one from scratch I would document how to get the autoloading working, since almost nowhere has it documented correctly. I forgot then too, so 3rd time lucky… The following code assumes the following: You have no model, controller or view directories at the root of application/ because they...
Testing and timing RDS/MySQL scheduled downtime with PHP
Something I was asked at work recently was “if we do this to the server, how long will it be unavailable for?” and usually the answer would be easy… however in certain circumstances you may not know. One of these is Amazon RDS, whereby you don’t really know what happens when you reboot or change the configuration of an instance, it just sort-of happens and eventually...
Google Geocoding API with PHP
If you want to know where a particular address is by latitude and longitude, but only have the normal address details like street, city, zip, country, etc. then the Google Geocoding API should be able to help. By passing it an address string it will try to work out (just like Google Maps) whereabouts the address is, and return you a JSON or XML response with what it managed to figure out. Below...
Samba share path incorrect even though it’s mounted in the Finder
Sometimes if a Samba share (Windows share or a Samba share from Unix) does not disconnect cleanly in Mac OS X, you may end up with a broken symlink in /Volumes/ This means that even if you re-mount the same share, and it will be named the same in the Finder, the actual symlink path won’t be the same. For example if you’re using a Workspace in Eclipse that points to that share, you...
Register EC2 Instances to more than one Elastic Load Balancer
For whatever reason, you may need to use more than one Elastic Load Balancer with your cluster of EC2 Instances; using a temporary domain that requires SSL for example (because you can only use one SSL certificate per ELB) where you need to point more than one domain with different SSL certificates to the same pool of web servers. However, when creating an ELB you’ll notice that you cannot...
Use phpMyAdmin with a remote MySQL server
Been doing relatively proprietary work recently, so not much to share other than this little tip. If you want to use phpMyAdmin but for whatever reason the MySQL server you’re using isn’t local, you can change the host by editing line 104 in config.inc.php in the root of phpMyAdmin: $cfg['Servers'][$i]['host'] = 'localhost'; … and optionally the port if required...
Deleting rows from a MySQL database based on multiple LEFT JOIN with foreign key constraints
Will write this up later...
Zend Framework, Zend_Db_Table ORDER BY sorting NULL as last instead of first
If you have a group of fields, some of which may be null (such as an address, in which the 1st line of the address may or may not be filled in) then you may want to sort them all so that if null appears in a field, it's sorted to the bottom of the list as opposed to the top (which is the default behaviour) $select = $table->select(); $rowset = $table->fetchAll($select...
WordPress 3.2 upgrade, WYSIWYG editor no longer loads? Now requires JSON extension
An issue I encountered recently doing a WordPress upgrade from 3.1 to 3.2, is that afterwards everything appeared to work with the exception of the editor for Posts and Pages. After working through the checklist for the manual install and checking each plugin individually, I took a look at the PHP error log and noticed that PHP didn't have the JSON extension bundled.