CakePHP MySQLi Connection Timeout
So, we’ve been wrestling a little with cron jobs that take a long time to do their thing and having CakePHP’s DBO lose connection to the DB. It never checks to see if there’s an active connection prior to saving/updating data and errors out. So today I’ve taken the time to do what I can and fix this annoying problem.
Here’s a little patch.
\cake\libs\model\datasources\dbo\dbo_mysqli.php
-
function _execute($sql) {
-
return $this->_executeProcedure($sql);
-
}
-
}
\etc\php.d\php.ini
-
[MySQLi]
-
mysqli.max_links = -1
-
mysqli.default_port = 3306
-
mysqli.default_socket =
-
mysqli.default_host = localhost
-
mysqli.reconnect = On
mysqli.reconnect integer
Automatically reconnect if the connection was lost.
mysqli::ping mysqli_ping
(PHP 5)mysqli::ping — mysqli_ping — Pings a server connection, or tries to reconnect if the connection has gone down
mysqli_ping() will attempt to ping the server. If there’s no connection.. mysqli_reconnect will establish a new connection and all is well again in CakePHP.
Easter Sunday Trance Mix
Spent the night putting together a relaxing trance mix– Enjoy!
Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.
Adventure in Game Development
Since my ADD is off the charts, why not add one more thing to the list of distractions? I’ve been tinkering with NeoAxis Game Engine which is built on the Ogre Engine. I’m quickly finding out it’s quite difficult to be everyone while developing a game. There’s so many different roles that need to be filled. There’s menus that need to be developed and coded for using the tools provided by the engines framework. There’s graphic elements that are needed for these menus. After that, there’s the in-game UI that needs to be designed and coded. You can’t have one element without the other. Going solo in game design could take years to complete anything ready for the masses– And this is with the ‘hard parts’ already done for you (3D, shading, lighting, physics, camera POV, etc). Even with a team of 3-4 people I could see a project taking years to complete. The biggest problem I’m having now is deciding where to start. Do I start on game UI? But I need menus to start/exit the game. Do I start on the characters in the game? They need weapons– Ugh. Weapons. You could spend a full week or more with modeling, skinning, assigning attributes and coding a single weapon! As I’m writing this my thoughts are all over the place just trying to describe how much crap needs to get done! I’m sort of hoping I’ll have some friends to help guide me and keep me on track. It’s just a personal project of mine and I don’t intend on releasing anything to the public. Just having fun experimenting.