Posts Tagged zend framework

Zend Framework error MySQL server through socket /tmp/mysql.sock

Posted on September 18, 2009 with No Comments

On a new apache/mysql installation, i got following error when connecting to mysql database in zend framework.

An error occurred
Application error
Exception information:
 
Message: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

This is because no socket /tmp/mysql.sock exists. Can be fixed by symlink to actual socket.

To find mysql socket, in mysql command prompt run

mysql> SHOW VARIABLES LIKE '%socket%';
+---------------+-----------------------------+
| Variable_name | Value                       |
+---------------+-----------------------------+
| socket        | /var/run/mysqld/mysqld.sock | 
+---------------+-----------------------------+
1 row IN SET (0.00 sec)
 
mysql>

Now we got actual socket location. Now create a symlink with command

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

This will make it work, but a reboot will lose the changes, so permanent solution is to edit /etc/mysql/my.cnf

vi /etc/mysql/my.cnf

Find

socket          = /var/run/mysqld/mysqld.sock

Replace with (all occurrence, 3 times)

socket          = /tmp/mysql.sock

registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0

Posted on June 18, 2009 with 2 Comments

On a new Zend Framework project created with Zend Studio, accessing the public folder, git following error

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 /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 207

This was fixed by editing Initializer.php

Find

require_once "Zend/Loader.php";

Replace with

require_once 'Zend/Loader/Autoloader.php';

Find

Zend_Loader::registerAutoload();

Replace with

$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('App_');