Archive for May, 2012

GD extension required

I’ve tryed to use some GD functions in php. Locally everything is ok, I use xampp on Windows. But when I moved my site to the server I get this error:

PHP Fatal error: Uncaught exception ‘WideImage_Exception’ with message ‘WideImage requires the GD extension, but it’s apparently not loaded…

In my php app the WideImage library is used and it utilizes GD library. So, there isn’t GD extension installed. Well, let’s install it:

apt-get update
apt-get upgrade --show-upgraded
apt-get install php5-gd

After installing php5 gd library the error have been gone and WideImage classes begin to work properly.

PHP has lots of libraries and modules. To list them you can use this command:

apt-cache search php5-

Then you will see:

php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language
php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dbg - Debug symbols for PHP5
php5-dev - Files for PHP5 module development
php5-gd - GD module for php5
php5-gmp - GMP module for php5
php5-ldap - LDAP module for php5
php5-mysql - MySQL module for php5
[...]

If you want to install a module run the command:

sudo apt-get install module-or-library-name

It’s possible to install several modules or libraries at once just separate them with a space.

How to disable directory listing

I’ve just searched for this approach but there are so many complex tips for this simple task.. So, in this article I’ll show you how to disable directory index in Apache web server.

Imagine, that you have a virtual host:

<VirtualHost *:80>
...
VirtualHost>

To disable directory listing you should add this line of code:

<VirtualHost *:80>
...
Options -Indexes
VirtualHost>

It works!

By the way, I tryed to remove Options directive but the directory listing wasn’t disabled.