Tag Archives: php

Silex and Phar on Dreamhost

You can’t run Silex apps directly on Dreamhost yet. After a bit of digging around I came up with this.

You need to create a file ~/.php/5.3/phprc in your home directory, not under the website directory and put these lines in there.

detect_unicode = Off
phar.readonly = Off
phar.require_hash = Off
suhosin.executor.include.whitelist = phar

Its not immediate, but in about 15 mins it should work.

Reference http://serverfault.com/questions/317416/enabling-phar-on-dreamhost-shared-hosting

Vote up my answer if it works for you.

Aptana PHP Formatting Tip

I like the Aptana PHP formatter. Its the only one that works well for me. I used to my one liner tags messed up a lot like this.

<?php echo $content

What I noticed was that the ones with the semi-colons in place didn’t break to a new line.

<?php echo $content;?>

Now the auto-formatter (Keyboard shortcut to Command + Shift + F on the Mac) keeps things in the same line.

Twig library for CodeIgniter 2.x

I’m trying to catch up with this social open source movement. I forked an existing CodeIgniter Twig integration library and added some changes to work with CodeIgniter 2.x.

Also I found a way map any CodeIgniter function to Twig like so.

$this->load->library('twig'); // load the Twig library
$this->load->helper('url'); // load the CodeIgniter URL helper
// map the base_url() function as a Twig function

Then in your Twig view call the base_url() function like this

{{ base_url() }}

Head over to Github for more details.

In case you have no idea what I’m talking about. CodeIgniter is an excellent PHP framework and Twig is a Django style templating engine with inheritance for PHP.

Fixing PHP Redirect On Nokia N80 Web Browser

I had a problem on a PHP page that was supposed to redirect to another page after some process was done. This is the code I used.

header("Location: http://example.com");

This kept giving me a

Web: no gateway reply

So after looking at the PHP manual for the header function and HTTP status codes I managed to get it working with this redirect.

header("Location: http://example.com", 307);

Side Projects and Collaboration

I’ve been getting some requests for small PHP projects. At the moment I’m not taking on any projects. If you still think I should have a look email me a specification or the requirement and I will try to give some feedback or recommend another person who might be willing to take it on.

Freelance developers! Please contact me with a brief of your skills so I can contact you when I get requests like this.