Today I had this error on my Ubuntu Linux box
Fatal error: Cannot redeclare geoip_country_code_by_name()
The reason was that I have geoip extension enabled in my PHP configuration and also I used the geoip.inc file from maxmind.com.
The solution is very simple.
It seems it is a bug (I didn’t investigate too much) in Ubuntu 10.x related to PHP files in userdirs.
On my box I have Ubuntu 10.10, Apache/2.2.16 (Ubuntu) and PHP 5.3.3-1. Everything worked fine except the PHP files from ~userdir. Instead to parse these files, the web server send them directly to the browser which open the “save as” window.
The problem is in /etc/apache2/mods-enabled/php5.conf file.
<ifmodule mod_userdir.c> <directory /home/*/public_html> php_admin_value engine Off </directory> </ifmodule>
These lines should be commented:
# <ifmodule mod_userdir.c> # <directory /home/*/public_html> # php_admin_value engine Off # </directory> # </ifmodule>
As you can see, we have the following folders:
– web: here resides your public files (images, css, and index.php)
– app: here you can find application files: models, views, controllers (MVC)
This pattern is probably one of the most simple and used pattern. As php manual says: The Singleton pattern applies to situations in which there needs to be a single instance of a class. The most common example of this is a database connection. Implementing this pattern allows a programmer to make this single instance easily accessible by many other objects.
There are tons of information about this pattern over the Internet so I let you google for it.
You can find a singleton implementation in Simple MVC framework example.