Thoughts, rants and commentary from a husband, father of five and professional web geek

Connecting PHP on Linux to MSSQL on Windows

Posted on March 31st, 2008 in Geek Stuff, PHP, Web Technologies | No Comments »

So last week I completed a task that involved setting up our PHP installation (which happens to be on a Red Hat Application Stack) to be able to talk to a MS SQL Server living on a Windows Server 2008 box while keeping my ability for PHP to talk to a Sybase Server living on a Solaris machine. Oh yeah, the Sybase extensions also needs to handle multiple result sets.

About 18 months ago I was in need of being able to talk to Sybase from PHP in a way that allowed Sybase to return multiple result sets and have PHP be able to use them.

This was not a huge problem, I thought, since just about all the beefy database servers can return multiple results and PHP can talk to just about any database server.

Boy, was I wrong.

After developing several high level headaches over the course of a few weeks trying to get multiple result sets to work, we found a solution that worked. Mostly.

It is a PHP4 hack to a PHP Sybase CT extensions that someone put together that allows the multiple result returns from Sybase to be captured. Unfortunately it also totally redefines the mssql_* family of functions at the same time. And I didn’t find out about that until after we had built the MSSQL extension and tried to run Sybase on the same PHP installation.

Anyway, if there is anyone else in the same boat as me, here is what I did to, first, get PHP to talk to MSSQL then to get PHP to talk to Sybase using multiple result sets. These instructions are for a Linux environment (RHAS, Fedora Core 6 and Fedora 7) using both PHP 5.1.6 AND 5.2.4.


Instructions:

  • Step 1: FreeTDS
    1. Download FreeTDS
    2. Unpack the tarball
    3. $]cd freetds-VERSION (where version is the FreeTDS version number)
    4. $]./configure --prefix=/usr/local/freetds --enable-msdblib
    5. $]make
    6. $]su root
    7. $]make install
    8. $]make clean
  • Step 2: SQL Server PHP extension
    1. Download the source for the right version of PHP (http://php.net/downloads)
    2. Unpack the tarball
    3. $]cd php-VERSION/ext (where VERSION is the PHP version number)
    4. Copy the mssql/ directory to someplace where you can compile it from
    5. CD to that directory
    6. $]phpize (this requires the php-devel package)
    7. $]./configure --with-mssql=/usr/local/freetds
    8. $]make
    9. $]su root
    10. $]make install
    11. $]make clean
  • Step 3: FreeTDS configuration
    1. $]vi /etc/freetds.conf (any editor available can used for this)
    2. Go to the end of the file
    3. Add the following lines
      ;--- Custom MSSQL server name ---
      ; THIS CAN BE ANY NAMED SERVER REFERENCE YOU WANT TO CREATE
      [SERVERNAME]
      ; This is the host name of the MSSQL server
      host=HOSTNAME
      ; This is the port number to use
      port=PORTNUMBER
      ; This is the TDS version to use for anything over Server 2000
      tds version=8.0
    4. Save the file and exit
    5. $]vi /etc/ld.so.conf (Again, any editor should be able to do this)
    6. Go to the end of the file
    7. Add the following line:
      /usr/local/freetds/lib
    8. Save the file and exit
  • Step 4: Enabling MSSQL PHP extension
    1. $]cd /etc/php.d
    2. If there is no file named mssql.ini create one
    3. Edit the file and enter the following lines if not already there
      ; Enable mssql extension module
      extension=mssql.so
    4. Save the file and exit
  • Step 5: Apache (This should be done any time PHP changes)
    1. $]/etc/rc.d/init.d/httpd stop
    2. $]/etc/rc.d/init.d/httpd start
    3. NOTE: $]apachectl -k graceful might work as well, though httpd start offers a status flag
  • Step 6: Test a file at the CLI and at the Web Server

If anyone wants the steps to setup the hacked version of the Sybase CT extension to handle multiple result sets, comment. I can post the files and instructions if anyone wants them.

Back to top

Cleaning house

Posted on March 30th, 2008 in General, Personal Messages, Rants | No Comments »

Have you ever walked into a room in your house and had the immediate desire to walk right back out of that room? Well, my house is that right now.

At least it was. Today I spent the better part of the day cleaning our house. Doing laundry, cleaning the kitchen, cleaning the living room, cleaning other rooms.

It was a tiring day because the house has literally not been touched for days. And in a house of 6 people (I don’t count myself in that too much because I am really not home that much) leaving things undone for more than a day leads to all sorts of stacked up funk.

In her defense, Sandi has been not feeling well since the after Easter. And the kids have not been of that great of health either.

And I am a piece of carp father and husband that never delegates anything to the kids so mom doesn’t have to do it. So that means that most of the condition of our house is actually my fault since I am really the one that should be taking care of these things.

SO I spent some time trying to catch up. It has been a little difficult for me these last few weeks to stay in the game. I have been working toward completing some of end-of-the-quarter stuff for work while working for two clients on two pretty large projects at night after work.

But in my house Sundays are a no-work day for me so I took today to try to catch up on some of the areas in my home that I am failing in.

Of course this left me with one burning question all day today: Why couldn’t there be five of me so that I could code with one, clean the house with the other, cook meals with the other, do schooling with the other and learn to be a better husband with the last one?

When is cloning going to be offered in an over-the-counter colorful little tablet again?

Back to top

Couldn’t resist

Posted on March 29th, 2008 in Funnies, On Politics | No Comments »

So I totally could not resist making my own Barack Obama poster. I am not an Obama supporter, but nonetheless, I found this to be very amusing.

Barack Obama says what’s that smell?

Barack Obama says Hillary? Pwn3d!

Barack Obama lolcats i can haz witehous?

So what do you think? Gotta an ideas of your own?

Back to top

^#$#*@(*$#@ car!

Posted on March 28th, 2008 in Personal Messages, Rants | No Comments »

A couple of days ago I noticed something strange on my tires. It looked at first like my tire had been slashed. But after further inspection…

Me tires are cracking

More crack. Just say no.

Can it get worse?

Yes, it can get worse.

Yep, you saw it with your own eyes. My tire was cracking.

No, not all of my tires. Just the one. And it is only two years old.

This buggered me rather. Not so much the fact that my tire was cracking but that my tires were well enough worn that I couldn’t safely replace just one.

So it stands to reason that I would replace all four tires. At great expense.

And since the assistant manager at America’s Tire was so convincing and so will to take huge amounts of money of the cost of wheels too, I ended up pimping out my hooptie with new tires AND new wheels.

Yep, there was nothing else I could think of better to do yesterday than to wake up, miss a half day of work and spend $800 on getting my car drivable again.

Of course, now my cars is dead sexy and I love to drive it now that it drives all smooth and safe.

Now if I could only see the way these wheels look on my ride as I drive… Now that would be something.

PS If you are in the market for new tires might I suggest staying away from anything that ends in “stone”. These were Bridgestone Potenzas. Usually a very good tire but this time, not so much. And don’t get me started on Firestone’s.

Back to top

Dude. America. What’s up?

Posted on March 27th, 2008 in American Idol | No Comments »

Okay, I think America got it so wrong.

Chikezie? Come on. He actually performed really well this week. I think he sung his butt off.

The others escaped this week. Let me tell you there are a few contestants that should be sending out a lot of Christmas cards this year.

Chikezie, sorry bro. I liked you a lot this year.

Back to top

Who’s it going to be this week?

Posted on March 26th, 2008 in American Idol | No Comments »

I can honestly say that I only saw the last half of American Idol last night. But from what I saw I can say that there are a few contestants that I think may have a harder time making to next week than others.

First let me say that I am almost certain that David Cook will walk away with this thing if no one else sets themselves apart. David, week in and week out, brings it. Hard.

David Archuleta and Michael Johns stand a chance. Outside of that I think everyone else is walking a thin line.

This week, I think that line will be walked with intrepidation by:

  • Carly Smithson who showed no emotion in her performance of Total Eclipse of the Heart
  • Jason Castro sang as plain as anyone could
  • Syesha Mercado once again proved that she is predictable singing a ballad type song
Back to top

My new default browser

Posted on March 25th, 2008 in Geek Stuff, Web Technologies | No Comments »

Well, I have finally taken the plunge and kicked Firefox to the curb.

This was not an easy thing to do for me since I have loudly and emphatically proclaimed the goodness that has been the Mozilla Firefox browser. Firefox has served me well but it’s life as a clunky, memory hogging beast that cannot keep itself open on even the simplest of pages has annoyed me for the last time.

Don’t get me wrong. I still love Firefox. But the only thing that I love about it now is it’s almost standard rendering of HTML. It is still extremely slow, extremely memory intensive and vary clunky.

When making this decision I had choices to make. No, there is no way in hell I would ever use IE for anything except to see how badly my standards compliant code breaks in it. Flock is nice, but it is really just a Firefox clone with some cool social stuff in it.

That leaves Opera, which in my opinion leaves a lot to be desired. Specifically what drives me the most nuts about it is it’s lack of extendibility. I am also not pleased with how slow it renders stuff. And the fact that I need to download and reinstall the entire application just to update the software irks me pretty good too.

So now that I am left with nothing there is only one thing left me to choose. That something is the Safari browser by Apple. And yes, they make one for Windows, too.

Safari is an absolutely amazing little browser. The newest version has a developer tool that comes close to some of the developer tools in Firefox. It also loads faster and has a way lower memory footprint than Firefox. Plus it is cleaner and its updater kicks butt.

I cannot sing the praises of Safari enough. It does everything I need it to and it does it how I want it done. If you are tired of Firefox or Internet Explorer maybe now is the time to consider making the switch to Safari.

Back to top

Easter why do you hate me so?

Posted on March 24th, 2008 in Personal Messages, Rants | No Comments »

Ouch! I feel terrible. And I think it is all Easter’s fault.

Yesterday was sort of a wild and busy day. It started with a very nice church service that was long enough to get the message across but short enough to not put people to sleep. The kids had a good time and Sandi and I had a good time.

Then we came home to have some rest time and things went weird from there.

I am working on a very large project for a client along with a smaller project for a different client. I thought I would take a little time to get some things done while Sandi and the kids rested. So I did. And I completely lost track of time.

My brother was having a small Easter gathering at his house that I found out about just three days ago. This was taking place at 2:00 PM. We also had plans to go to my in-laws as well. There place was at 4:00 PM. When I looked at my watch, it was 1:30 PM.

CARP!!!!

I quickly got the kids ready to go and asked Sandi if she wanted to stay home and sleep while I took the kids to my brother’s place. She nodded yes so I began the process of getting the kids ready to go. My thought was that I could have some time with my half of the family and when it was time to leave, leave the kids at my brother’s while I come home to pick up Sandi.

Thanks God that didn’t happen. Sandi woke up just in time for us all to head to my brother’s place together. Which was nice because we were able to spend family time as a family with my family.

We left my brother’s party a little after 4:00 PM to hit up the in-laws. The in-laws was nice as we munched in pulled BBQ brisket sandwiches and lots of great fixin’s. We also got huge Easter baskets for everyone in the family. Good times were had by all.

But then night crept up on us, and being as tired and worn out as we were we hit the sack and slept off most of the noise and rambunctiousness of the day.

And unfortunately after days like that there is always a day after days like that. And today is that day. And I can feel it. Badly.

But I guess the good news is that the kids will have enough sugar and carptastic treats to make them bounce off the walls for the next month and a half. No, wait. That wasn’t the good news. I guess the good news is we got tons of leftovers from the in-laws. No, wait. That wasn’t it either.

What there any good news from the yesterday? Oh yeah. Yesterday was the day Christ rose again and brought salvation and redemption with Him.

Ah yes, there was something good to come from yesterday.

Happy Easter. And Happy Resurrection Sunday.

Back to top

Happy Easter

Posted on March 23rd, 2008 in Personal Messages | No Comments »

For Christians: Happy Resurrection Sunday.

For everyone else: Happy Easter.

Whatever your persuasion, enjoy this Sunday. May your baskets be full of goodies and your day full of fun and joy.

Back to top

How to wear out a Saturday

Posted on March 22nd, 2008 in Personal Messages, Rants | No Comments »

It seems that time is something of a commodity as of late, and today that was more evident than it has been in a long time.

But before that I should get into last night. Last night the kids stayed at Grandma and Poppa’s house. So we had the house to ourselves. What does that mean? That means that I had a chance to make dinner for my wife.

I actually grilled some steaks for us. But that is not all. I also bought some smoked sausage which I also grilled and I sauteed some mushrooms to go along with them. I bought some bread, some pasta salad, and some veggies to make a huge green salad. And I opened a bottle of the 2004 Roth Cabernet that I mentioned a few days ago.

Then I made the table smaller, cleared it off, turned down the lights and lit a candle and my wife and I had a nice candlelight dinner right at home. Then we proceeded to sit on the couch and watch TV until late in the evening.

With that, I can say that I was very tired to start the day off. All of last night’s activities were done after I had gotten home from work so my day yesterday was very, very long.

Today though was really nice. I woke up, slowly, and tried to figure out where to go to breakfast. After a little bit, and since we were heading to San Ramon anyway to hit up Whole Foods, I decided that we would go to Katy’s Korner on San Ramon Valley Boulevard, just South of Crow Canyon Road.

I loved the meal, the atmosphere and the service. The wait time wasn’t too bad either. I am very glad we hit this place up. If you are ever in San Ramon and want a great breakfast, stop at Katy’s Korner.

After breakfast we went to Whole Foods where we laid down some savage cash for Easter treats for the kids. We have begun a new diet that is based on all natural foods. Most of the current Easter candy does not fit into the category of all natural, so we have to make amends for that. Hence the trip to Whole Foods.

And the trip to Walmart, after which we came home and Sandi began assembling Easter Baskets.

I know there was a lot more to this day that just that, but it all happened so fast that it is really a blur. Plus I am still very tired. But it was a good day. And I am now greatly looking forward to Easter tomorrow.

Back to top