Archive for June, 2009
Zend Framework v1.8x Zend_Loader replacement
Last night i was trying to push a application to my staging environment. When i noticed an error i didn’t had on my local box.
Notice: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in /path/to/Zend/Loader.php on line 207
A quick check revealed that i had a newer version of the Zend Framework loaded on my staging environment. Locally i have 1.7x and on the staging environment i have 1.8x. And according to the documentation the old Zend_Loader is being deprecated in favor of Zend_Loader_Autoloader.
So in ZF projects prior to version 1.8x when enabling autoloading we would do something like this:
require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload();
With the new Zend_Loader_AutoLoader this will look something like this:
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Namespace_');
Notice the call to ‘registerNamespace’. This is where you set the namespacing for the classes or application libraries. By default the AutoLoader picks up Zend_ and ZendX_ namespacing. And we can extend this to use our own classes and libraries.
Zend_Db connects to wrong mysql socket
While working on a small project today. I was confronted with a Zend_Db exception that i have seen before. But it still had me searching for a solution. So this time i will write it done for future reference.
I’m working on a small ZF project which uses the MVC structure. And in the Initializer the database connection is setup like this:
public function initDb()
{
$pdoParams = array(
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
);
$params = array(
'host' => 'localhost',
'username' => '***********',
'password' => '***********',
'dbname' => '***********',
'driver_options' => $pdoParams,
);
$db = Zend_Db::factory('Pdo_Mysql', $params);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
Zend_Registry::set('DB', $db);
}
So when i first instantiated a connection to the database i was presented a nice error on screen. The stack trace is quiet long. But this is the most relevant part.
exception ‘Zend_Db_Adapter_Exception’ with message ‘SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)’
The php bug tracker revealed a nice solution. For some strange reason the PDO extension can’t determine the correct socket while the mysql, mysqli extensions can. This is easily solved in the bootstrap of the project by adding an extra parameter to the config array passed when calling Zend_Db::factory();
$params = array(
'host' => 'localhost',
'username' => '***********',
'password' => '***********',
'dbname' => '***********',
'driver_options' => $pdoParams,
'unix_socket' => '/var/run/mysqld/mysqld.sock'
);
$db = Zend_Db::factory('Pdo_Mysql', $params);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
Zend_Registry::set('DB', $db);
PHP 5.3 almost ready for release.
The long awaited 5.3 version is near it’s final stage. I’ve been really looking forward to this.
1. July 24th – feature freeze COMPLETED
2. July 31st – alpha1 COMPLETED
3. September 2nd – alpha2 (freeze on August 29th, final packaging on September 1st) COMPLETED
4. December 4th – alpha3 (freeze on December 2nd, final packaging on December 3rd) COMPLETED
5. January 29th – beta1 (freeze on January 26th, final packaging on January 28th) COMPLETED
6. March 24th – RC1 (bug fixing until the 19th, with RM ok commits until 20nd, until 23rd build fixes only) COMPLETED
7. June 7th – RC2 (bug fixing until end of the 4th, after that only build fixes and README changes) COMPLETED
8. June 11th – RC3 COMPLETED
9. June 18th – RC4 COMPLETED
10. June 30th – stable
11. Continued RC releases in 2-4 week intervals
12. Stable release around Q2 2009
Web trend map 2009
A few days ago i received the latest version of the IA Trend Map. This year even the tube it was shipped in looks good! This years design is a landscape view. Which forces me to buy a new frame. But it’s worth it. Now only need to find a spot for it.
The map visualizes the main websites / companies based on a hand full of variables. Where height stands for the success rate and width for the stability. This all is spread on top of the Tokyo Metro Subway. The 13 subway lines reflect different web sectors in which the companies / websites opperate. A new addition to the map this year are the people behind the companies / websites. Which gives just that little bit of extra information.
The map depicts each website or company as a Tokyo station that corresponds in buzz, traffic, revenue, and age. The height of a station represents success, while its width indicates the stability of the domain.
Postfix with Dovecot results in MySQL Access denied
While installing a new mail server i ran into a problem with SMTP authentication. The mail server in question is postfix installed on a Debian lenny box. The backend for postfix is MySQL. And because SASL is always a pain to configure i used dovecot to do the SMTP authentication with the MySQL backend. This however resulted in the following error
Jun 21 17:43:02 ims1 dovecot: auth-worker(default): mysql: Connect failed to localhost (mail): Access denied for user ‘mail_admin’@'localhost’ (using password: YES) – waiting for 1 seconds before retry
It took me a while to figure this out. The settings in ‘dovecot-sql.conf’ were correct. Logging in with the same data from a shell went without a problem. I remembered i had this problem some years ago. With a vpopmail setup. The problem then was the encryption algorithm used by MySQL. So i tried to use the older encryption algorithm.
SET PASSWORD FOR ‘user’@'localhost’ = OLD_PASSWORD(‘password’);
After a restart everything was fine.
Jun 21 18:41:03 ims1 dovecot: auth-worker(default): mysql: Connected to localhost (mail)
Like i said it took me a while to figure out. So maybe i can safe somebody some time.
No Thunderbird labels when using imap over SSL
Last week i moved one of our domains to a new server. After syncing all the email between two servers i was happy i didn’t had any problems in the process. But a few days later one of the girls in the office noticed she can’t share labels anymore. This is a big problem since we have one mailbox that is shared over 4 people. When somebody works on a newly arrived mail they can tag it so the others can see it’s being worked on.
So after some hour of playing with settings i figured out the problem was SSL. If i disable SSL the labels come through normally. If i enable SSL no labels are being loaded. At this moment i am not sure if it’s a mail server issue, a mis configured SSL certificate or maybe a bug in Thunderbird. Will do some more research when i get back from my well deserved vacation.
There seems to be some sort of solution available in the form of an extension for Thunderbird. But it’s only available for v3 and up!
So the workaround for now is to disable SSL. I’m not to happy about it. But it will do for now.







