Tagged syntax

Solving ‘org.apache.httpd: Already loaded’ error on Mac OS X Snow Leopard

I recently ran into a problem where my local Apache instance wasn’t responding to requests. Trying to restart or start it with sudo apachectl restart yielded an error message like this:

org.apache.httpd: Already loaded

Checking running processes, I noticed that apache wasn’t actually running, which seemed a bit strange. Luckily, apachectl offers a helpful command for checking your config syntax, apachectl configtest. Sure enough, it turned out I’d modified the httpd.conf a couple of weeks ago, but never rebooted Apache. Commenting out the offending line and starting Apache fixed the problem and I’m back up and running.

CodeColorer for WordPress is totally sweet

After trying out a few code snippet plugins for WordPress, and not having much luck, I found CodeColorer. CodeColorer creates a nice code box for your snippet, which is quite visually appealing. Here’s an example of some php:

[cc lang=”php”]
echo $foo;

Once you look at the code snippet that CodeColorer outputs, though, you start to get a sense of everything that it can actually do. For example, mouse over one of the functions above, and you’ll notice it links you to the appropriate function reference on php.net. I’ve just started working with the plugin, so I’m sure I haven’t tapped all the features yet, but so far I’m quite impressed.

Get Vim syntax highlighting in CakePHP template files

If you use Vim to edit your php files, you’ve probably got some sort of default syntax highlighting for those files that’s helpful in debugging code. Of course, if you use CakePHP, Vim won’t see your .ctp template files as the php/html combination they really are, and you’ll just see plain text. To fix this, you can add the following line into your .vimrc file (usually located in the root of your home directory):

[cc lang=”vim”]autocmd BufRead,BufNewFile *.ctp set filetype=php[/cc]

When you launch Vim, it will now interpret your ctp files as if they were php (which they pretty much are), and you’ll be able to get the same colors and syntax highlighting.