Recursive. Custom web app development

Back to the blog

RSS

Recent Posts

Most Popular Posts

  1. Why you should be using a framework
  2. Dynamic methods in PHP
  3. Rewriting URLs with Apache's mod_rewrite and PHP
  4. Five easy things that make you a better web developer

About the Blog

Self portrait

I'm a web application developer in Melbourne, Australia. If you find anything useful, leave me a comment, and if you need web design, development, or accessibility and usability consulting, contact me! Cheers.

Twitter: joshsharp

a bird
Posts tagged apache:

How to add extensions to PHP 5 running as an Apache 2 module

Sunday 04 Nov, 2007

Just a quick tip — hopefully this will help anyone having the same issue as I was. Our development server at work runs Ubuntu 6.10 (using the default Ubuntu LAMP setup), and this setup happens to use Apache 2, with PHP as an Apache module (rather than a CGI extension, or whatever).

Now this default setup doesn't include some fairly standard PHP extensions like cURL and the GD libraries — but working out how to get these included caused me no end of trouble. I didn't want to recompile PHP, but didn't understand why adding a reference to libgd.so was giving me the error that it wasn't a valid PHP library. And surprise surprise, it's not; you need the PHP bindings. So for those who are in the same situation and don't want to recompile PHP, but need those extensions, there's actually a very simple solution that was incredibly hard to find on the web.

You can just install the packages from the repository.

So if you're a GUI person, you can use Synaptic and search for "php5" to retrieve the list of available modules. Or if you prefer the terminal, it's as easy as typing sudo apt-get install php5-gd or sudo apt-get install php5-curl.

I wish somebody had told me that.

Tags: apache
9
comments

Rewriting URLs with Apache's mod_rewrite and PHP

The start of an MVC framework

Sunday 28 Oct, 2007

For those of you who aren't aware, Apache provides a very nifty module called mod_rewrite which (can you guess?) lets you rewrite URLs, with or without the end-client knowing. As I've mentioned before, this can be pretty handy. No longer must your URLs look like domain.com/folder/subfolder/file.php?some_id=23. Instead you can present your users with pretty URLs like domain.com/area/action/this_is_a_unique_identifier, and anything along those lines.

There are two main reasons why you'd want to do this:

  • Accessibility for users: your users don't need to remember long GET parameters, or file extensions for that matter. URLs can become more relevant to the content and to the user.
  • Accessibility for search engines: yes, this will help you quite a lot with The Google. You now have a far bigger chance to put your relevant keywords into the URL, which is one of the places they count the most.

So let's have a look at how you'd do this.

Keep reading

10
comments