CategoryDevelopment

Web development related information

Capistrano website deployment with PHP Composer

Composer is great for handling PHP dependencies, and Capistrano is great for automated deployment, so wouldn’t it be great if you could use them together? To do this, all you need to do is update your recipe with the following task, then add a hook to make it run when the recipe is used. To add the hook, make sure that Composer is triggered after finalize_update (which means it will happen...

Disable auto-correct for oh-my-zsh when using Chef Knife (or other commands)

oh-my-zsh is great, but certain commands it doesn’t like, for example the Knife CLI tool for Chef. Luckily it is possible to disable auto-correct as required. sudo vim ~/.zshrc To disable just auto-correction for Knife, add the following line somewhere in the configuration nocorrect knife To disable all auto-correct (which I prefer personally) add the following line somewhere in the...

PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/module.so’

For some reason (I think just on Red Hat/CentOS) you may end up with a bad reference in mcrypt.ini so “module.so” as opposed to “mcrypt.so” To update this simply edit mcrypt.ini so that it points to the right extension (instead of what I’m assuming is placeholder text) vim /etc/php.d/mcrypt.ini You should see the following… ; Enable mcrypt extension module...

Concrete5 “Fatal error: Class ‘View’ not found”

Concrete5 may present you with the confusing error “Fatal error: Class ‘View’ not found”, which looks like a Loader issue but often it is not. When moving between different servers, the database permissions may not be quite right, which will cause this to happen. If you check that the user that Concrete5 is using has access to the database and the correct credentials, then...

“Could not open configuration file /usr/local/zend/etc/sites.d/zend-default-vhost-80.conf”

If you’ve upgraded from an older version of Zend Server than 5.6 up to 6.0 you may have ended up with a patched httpd.conf that references a vhost configuration file that has not been created. If you try to start Apache you may see this message: $ sudo apachectl start httpd: Syntax error on line 428 of \ /usr/local/zend/apache2/conf/httpd.conf: \ Could not open configuration file \...

How to safely handle PHP “__toString() must not throw an exception”

Because there is no safe way to handle an exception thrown during __toString the easiest workaround for this is to catch all exceptions thrown and return either an empty string or null.
Since any invocation of __toString will expect a string back, it is a graceful way to handle any under-the-hood errors if you’re using __toString as a shortcut to echo out objects.

What does vagrant up do, where does the box get downloaded to?

Vagrant is a pretty nifty tool that simplifies developing on a Virtual Machine. However it is sometimes not obvious what happens in the background! An example of this is where your VM’s actually get downloaded to, and how they are managed. Since Vagrant acts as a wrapper for VirtualBox (or VMWare Fusion more recently) when you “add” a box, it essentially downloads a pre-built...

Convert non-Java Eclipse ADT project to Android project

If you’ve imported a project into Eclipse, say from Git for example, then it might not be set as an Android project. There doesn’t seem to be an easy way to convert the project to an Android project through Eclipse itself, but you can change the nature of the project by editing the project XML file. Close the project in Eclipse Open .project in a text editor Assuming...

“Your proxy directory must be writable”

When you first start off with Doctrine 2, you’ll eventually start creating complex objects with child objects as properties, which of course you will use Doctrine to load. Unlike how you’d do it traditionally though, Doctrine uses proxy pattern objects to lazy-load these child objects until they are accessed; these objects are cached, and thus the proxy directory just like the cache...

“The class ‘x’ was not found in the chain configured namespaces”

If you are getting a namespace chain error when trying to load entities with Doctrine 2 in Zend Framework 2, it is likely because as far as Doctrine is concerned the namespace your entity is in is missing. If you’ve copied Jason Grime’s Doctrine 2 and Zend Framework 2 tutorial then you’ll notice the configuration he places in module.config.php array( 'doctrine' =>...