Markus Hedlund

Developer / Photographer

Contact / GitHub / Instagram

“2006 - MySQL server has gone away” error when importing with SQLyog

Get this annoying error when importing a database with SQLyog? "There was an error executing the query. […]". When you click "Open error file…" the real MySQL error is presented: "Error Code: 2006 - MySQL server has gone away".

Solution

Open "my.ini", located in your MySQL installation folder, and change "max_allowed_packet = 1M" to "max_allowed_packet = 64M" or something higher than 1 MB.

The problem is that SQLyog sends a massive SQL query that exceeds this limit.

PHP: Get filename extension with native PHP function

The extension part of the filename, is what typically tells us what type of file it is. A JPEG image may have the filename "image.jpg", where "jpg" is the extension.

Click through to learn how easy it is to extract this with PHP.

echo pathinfo('filename.jpg', PATHINFO_EXTENSION);

Easy as that! This will output

jpg

pathinfo can be used for much more than retrieving the file extension, please see the PHP documentation for all options.

PhpED: Get back Tortoise SVN in the shell menu

After I reinstalled my system with Windows 7 64 bit, the very handy SVN Tortoise icons were all gone from the shell menu in Nusphere PhpED. This made SVN actions so much more time consuming.

The problem turned out to be that Tortoise SVN was a 64 bit application, and PhpED still is a 32 bit application. For both 32 and 64 bit applications to see Tortoise's shell extensions, you must have both 32 and 64 bit Tortoise installed.

Just having the 32 bit version wont do; Windows Explorer and other 64 bit application will not see the icons then.

Simply download the 32 bit version at http://tortoisesvn.net/downloads, and you should be all set!

Pro tip: Hold down CTRL while right clicking (or pressing the context menu button on the keyboard) in PhpED, and the shell menu will appear directly!

Install PHP 5.3.3 on WAMP

The latest PHP version provided by WAMP is currently PHP 5.3.1. Continue reading if you want to install a later version.

I successfully installed PHP 5.3.3 on my WAMP server under Windows 7 64 bit. But this short tutorial will probably work on other versions as well.

Go to the Windows download page at PHP.net and download the desired version. You must select the ZIP VC6 x86 Thread Safe variant.

Unpack the contents to the PHP bin directory in your WAMP installation. I unpacked PHP 5.3.3 in C:\wamp\bin\php\php5.3.3.

You should now copy the following files from the php5.3.0 directory, to your newly created directory (php5.3.3 in my case): php.ini, phpForApache.ini and wampserver.conf.

Now we just need to make a quick edit in both INI-files. Search for "5.3.0" and replace it with the PHP version you are installing.

Save the files, and you should see the new version in the PHP version menu in WAMP. If not, right-click the WAMP icon and choose "Exit", then start it again.

Fixing audio glitches and delay with Realtek HD audio / ALC892 and optical / toslink connected speakers

Earlier this summer I finally came around to put down some money on a new computer. This is an all work - no fun rig, kicking some six-core action and other hefty figures.

I chose an Asus branded motherboard, namely the M4A89GTD PRO/USB3. I use the onboard Realtek HD Audio / ALC892 audio chip, connected to my Logitech Z-5500 speakers via a toslink / optical cable.

Sadly, the audio hasn't been working that great for me. I had this problem where the audio would stutter / glitch, and everytime an audio source began playing, there was a delay of about half a second before the speakers recognized the stream.

The solution

The solution was simple! After some searching, I found that Realtek had updated their driver. I just removed the old, downloaded the new, installed it and rebooted. All problems had magically vanished!

Download the latest driver

[Update] Alternate solution

Brice Center had similar issues. He solved these and posted a thorough guide at his site. Thanks Brice!