Web Design & Development Blog

My PHP MySQL SSH tunneling experience

First, little background on why I’m writing this blog post… I have a client that has a “semi-dedicated” hosting account. In most respects, this account is just a fancy shared hosting account, but they say there are less accounts on the server. The client’s website is on that hosting account. The client also has a server at another location. I have root access to that server, and the client wants to be able to have that server do direct MySQL queries on the website’s database.

Read More …

Posted February 20th, 2017 in , , ,

DOMPDF: Image not found or type unknown

If you are using DOMPDF on a server environment that has a self-signed security certificate, or perhaps the certificate name doesn’t match what it should, DOMPDF will not load images or other assets without specifically creating a stream context that allows it to do so.

Read More …

Posted May 25th, 2016 in

Switching from MySQL to MariaDB on Ubuntu 14.04

I’ve known about MariaDB for a while, but because I wanted my development machines to match my production environments, I just stayed with MySQL. Today I found out that the production environments switched to MariaDB, so I searched around the internet to find out how to do the switch on my development machines. All are running Ubuntu 14.04, so I thought that as long as I could do it on one, it would be easy to do the rest. Well, that would be the case if there were good instructions somewhere, but I had to piece together a solution that worked for me, as I was getting error messages after following the advice of others.

Read More …

Posted December 22nd, 2015 in , , ,

Community Auth for CodeIgniter 3.0

I resisted doing anything with CodeIgniter 3.0 for a long time, mostly due to the licensing that Ellislab had said they were going with. BCIT changed the license due to popular demand, and with an EOL notice for the 2.X branch posted about a month ago, I decided it was time to convert Community Auth over to CodeIgniter 3.0.

Read More …

Posted July 17th, 2015 in ,

Text Editors Freezing on Search & Replace

I created a script that is run via cron that backs up the database of one of my websites, gzips it, and emails it to me. It works great, but I like to use a text editor to search and replace the domain name, so that I can use it in a development environment. As the backup file has been getting larger, I’ve reached the point where neither Sublime Text or gedit will do a “Replace All” without totally freezing. Linux makes this a non-issue:

#search for production.com and replace with dev.com
sed -i 's/production.com/dev.com/g' ./production-dump.sql

#overwrite dev database
cat ./production-dump.sql | mysql -u username -ppassword database

Posted May 6th, 2015 in

Easy Backup & Restore a MySQL Database

If you want to make a database backup, it’s better to not use phpMyAdmin, because larger databases will cause that method of backup to fail. Instead, just use mysqldump, which should already be installed if mysql is installed:

mysqldump -u username -ppassword database | gzip > ./dumpfilename.sql.gz

gunzip < ./dumpfilename.sql.gz | mysql -u username -ppassword database

Read More ...

Posted February 16th, 2015 in ,

MySQL: Convert Column From One Timezone to Another

It’s a pretty common thing to find an app that doesn’t specify to MySQL the timezone that should be used when storing dates and times. Once you’ve fixed that, you may still have a bunch of dates and times that need to be converted.

Read More …

Posted February 14th, 2015 in

« Older Posts