Monday, December 31, 2012

Wordpress: Dynamically watermark all the uploaded images

I found a nice solution to dynamically watermark all the uploaded images in Wordpress. I'm not going to repost the solution here. Here is the link: You can also download a zip file that includes the image, php file and htaccess code.

Monday, December 3, 2012

Solution to "MySQL Server has gone away" error

When I was trying to import a large sql file (about 11MB) in phpMyAdmin, I got "Error 2006: MySQL server has gone away".

Solution to the above error in XAMPP is as follows:
  • In xampp\mysql\bin\my.ini file, set
    max_allowed_packet to something like 10M or 20M (larger than the sql file you are trying to import)
  • Save the file and restart Apache and MySQL servers.
That should do it. There is no need to make changes to php.ini in this case.

However, if you need to import even larger file (say 4GB), then you will need to modify both my.ini and php.ini file.

For modifying xampp\mysql\bin\my.ini, follow the steps as above to set
max_allowed_packet = 4GB.

Then modify xampp\php\php.ini, set
post_max_size = 4G
upload_max_filesize = 4G

Save the files and restart Apache and MySQL servers.