I was moving a site from one server to another which has a lot of database transactions, and I did not want to lose any. So at 2am I started the move, at this time the traffic is fairly quiet. Then I realised that neither hosts allowed remote access to MySQL without their super admin’s help. I didn’t like the idea of trying to sync the databases up after the fact so I created an SSH tunnel to the new DB. This meant I could have the old server’s PHP talking to the new server’s MySQL until the DNS propagation was complete.
To do so:
1. I exported a MySQL dump from the old DB server and upload it to the new server
2. In terminal (PuTtY for Windows fans) I SSH into the old server and from there created a port (3377) on the old server which pointed to the new server
[cc lang=”bash”]ssh -L 3377:127.0.0.1:3306 firstname.lastname@example.org[/cc]
3. I wanted to see if it worked so I run MySQL in a new terminal window (the existing terminal window needs to remain open, as the switch over of A-Record will not take long I am not worried)
[cc lang=”bash”]mysql -u dbuser -p -h 127.0.0.1 -P 3377[/cc]
4. MySQL on the old server was able to connect to the MySQL instance on the new server
5. Finally I needed PHP on the old server to connect to the MySQL on the new server while the propagation period is taking place
[cc lang=”PHP”]$db = mysqli_connect(‘127.0.0.1’, ‘dbuser’, ‘password’, ‘the_db’, 3377);[/cc]
And that is it!
A few people have recently asked me about outputting data to Excel. This is a very simple thing to do from PHP with two lines of code.
[cc lang=”PHP”]header(“Content-type: application/vnd.ms-excel”);
header(“Content-Disposition: attachment; filename=webbased.xls”);[/cc]
When designing an ecommerce solution there is many challenges which the developer needs to take into consideration to save time and frustration for both them and the client. Good planning and asking the right questions up-front will help in over coming the challenges. Below is a list of some of the challenges faced in creating an ecommerce solution and some basic questions that should be asked to minimise the challenges.
Ecommerce is focused on workflow compared to website design which is focused on content and layout. When designing an ecommerce solution the most important part is to understand the workflow. This involves working through each of the stages of the process the solution is meant to solve. While there may be existing processes, the online tool should be about refining those processes instead of just creating an online version of the offline solution. The first questions that should be asked are:
Photo by Joel Mark Witt Continue reading
I must say my favourite tool I ever built is Toolnames.com – Domain Name Generator and Toolnames.com.au – Domain Name Generator. It is simply the best at finding unique and awesome domains.
Today I found CashInHand.com.au and the other day crappy.com.au. The tool is super easy to use and logical. All of the results are in a single window.
After using this domain generator you will never use another one again.
Mortgage brokers have for years used the web as a source of leads to get into the house of buyers. Mortgage Corp want to defy this process and provide customers with control, flexibility and real-time results of the loans which best suit the customer, not necessarily which earn the greatest commission. Create My help Mortgage Corp achieve this with the Mortgage Home Loan Calculator.
Most of my sites I build use MySQL and PHP. Most of the sites are interactive and need input from users. This opens up a big security hole where hackers can use a simple ploy called a SQL Injection and insert some nasty code. In the blog post MySQL Tutorial – SQL Injection covers the mysql_real_escape_string() PHP command which helps reduce the risk.