Zend Framework – Mysqli – Socket Connections
I found my first real dislike / flaw in the Zend framework; it was easily fixed thanks to a write-up that I found online, but still annoying.
It appears that in the database adapter for mysqli within the ZF the use of a socket for your connection rather than directly from host was not permitted. There is an simple solution that I found at This website, and after making these adjustments to the zend library everything works fine.
The fix is as simple as adding $socket to an array that is then passed to the ZF connection protocol. I am very curious as to why the ZF team left out socket from the connection string for mysqli and not for other database adapters.
24 Jun 2008 vMonkey
According to this issue: http://framework.zend.com/issues/browse/ZF-1914
“The MySQLI extension doesn’t need any change, because the socket location is specified in a php.ini configuration.”
If you feel that’s not an ideal solution, please let me know. wil@zend is the email.
Hope the framework is working out for you otherwise.
,Wil
Wil,
Thanks for the reply. I am not sure if this is really a question of is the solution ideal or not. I think it is more situational; and possibly just poor setup on my end (my employers end).
Our php.ini does specify a default socket for mysqli, but the situation we run under is multiple installations of mysql running on a single server, which has led to 2 or 3 sockets connecting to different mysql servers. The question of having this type of mysql setup being smart or not?… well thats a different discussion, personally I do not like it.
In a recent project I opted to use the ZF, and with this project required a connection to one of the sockets that was not the default. From a pure coding perspective, yes it is easier for me to specify in my ZF config the socket for the connection to use. I do recognize however that easier is not always better or even ideal from a coding standard.
As far as the framework, I love it. Fast development, ease of use. All-in-all a good product.