Using PHP to Copy an SQL Server Table to MySQL

At work, we have a scheduled task run every day that pulls information out of a huge Oracle database and dumps it into a Microsoft SQL table on one of our local IIS Web servers. We then have a script on our remote LAMPP Web server (the one we use to serve up our public Web site) that queries that MSSQL table and displays results on the Web site.

Unfortunately, because the Web server and the MSSQL server are in different locations, the results are sometimes slow and unreliable. For instance, if, for some reason, the network connection to our IIS server is down or if the IIS server itself is down, we can’t pull any data from the MSSQL table.

The other day, I began working on a script that will pull only the information we’ll need for any given day out of the MSSQL table and then create a new table in our MySQL installation that resides on the same server as our Web site.

Following are some good tips for you if you decide to do the same thing.

Setting Up Google Apps (Gmail) For Your Domain

The other day, I was talking with my friend Aaron (@riddlebrothers) about all of the various e-mail addresses we have and how we use them. At one point, after discussing the virtues of using Yahoo! Mail, I mentioned that the e-mail addresses I have hosted on my own servers are often unreliable. I told him that I rarely give out anything but my Yahoo! e-mail address, because a lot of messages get lost in cyberspace with my other accounts.

He asked me if I had looked into using Google Apps for my domain-based e-mail services. I honestly hadn’t thought about it before (in fact, I made a post a while back about how strange it was that everyone was moving to Gmail). However, his suggestion made sense. Following are some of the advantages I see in moving your e-mail over to Google Apps:

Redirecting and Duplicating Content Properly

There are certainly times when all Web developers and “information architects” find themselves in a situation where they need to move content from one page to another. When you do so, you need to redirect visitors from the old location to the new location, and you need to do so properly. To do that, you need to make sure that the old location returns the correct status code (301 – Moved Permanently). There are a number of ways to do this. The most efficient way, for apache users, is to set up a redirect inside of your .htaccess file. However, if you don’t have permission to set up redirects within .htaccess, you can use PHP (or any other server-side scripting language) to do so. Using meta refresh tags and javascript is not generally the best way to redirect your visitors.

Managing User Permissions on Unix

I am basically posting this here as a reference for myself, but I’m sure the information will be helpful to other people out there, as well.

Occasionally, when working on my Web server, I need to create a new user on the server and grant one or more other users permission to view and edit files within the new user’s home directory. This task, in itself, does not seem all that difficult on the surface. However, because most Unix servers are set up (and rightfully so, for security purposes) not to allow most users to navigate outside of their own home directories, it becomes a problem.

Let’s say, for example, that you have two users on your Web server that you want to allow permissions to view and edit each other’s home directories, but you don’t want them to have access to any other files and folders on the Web server.

Rewrite and Redirect for IIS – Sort of

Last week at work, we unveiled one of the new Web sites I’ve been working on for a while.  In doing so, we removed the old Web site completely from the server and replaced it with the new site.

Of course, when we did so, a lot of our old links became obsolete, so I had to find an effective solution to keep our regular visitors from going bananas when they tried to access some of their favorite pages.  That’s when I began to look into some options for redirecting without having to create placeholder pages just for those redirects.  After quite a few fruitless searches, I was able to piece together a fairly good solution, and also discovered an easy way to achieve URL rewriting on an IIS server (similar to the way you would with htaccess on an apache server).

First, you need to set up your “404” so that it points to a VBScript page.  That’s the most important part.  Once you’ve got that done, navigate to a page that you know does not exist on your server, just so you can test the behavior of your 404 page.