February 25th, 2010 §
I am used to installing these on CentOS. I did it so many times, I just wrote a script to do it. Simple!
However with Mac OSX and MacPorts, I was having trouble.
I installed MacPorts and then ran through the installers for Apache2, PHP5, and MySQL5 (including the MySQL server)
Set up my http conf file with virtual hosts and this is where everything stopped. I could not get a page to load, and if I did get one to load it would not connect to MySQL.
The problem was my mysql socket. So I made this change:
/opt/local/var/run/mysql5/mysqld.sock
Then, sessions wouldn’t work, so I had to do two things:
- Set the permissions of /private/tmp to 777
- Change the php.ini setting for session.save_path to “/private/tmp”
Once these were done, I was able to load a page and connect to MySQL.
Sphere: Related Content
December 22nd, 2009 §
I pushed a new version of Twindicate.com live two days ago. That night I was up till 3:45am trying to figure out why OAuth was not working at all. All I could tell was that I was getting a “401 Unauthorized” response from Twitter. I was completely torn apart by this, because I have put hundreds of hours into Twindicate. I honestly thought that Twitter had shut me off without telling me (sorry Twitter).
I tried regenerating my consumer keys, I output lines of debug code at every single step along the oauth code path, I stayed up late two night in a row. I almost cried, I was really choking it back there for a little while. I searched google with no quality results helping me figure out what the issue was.
After 2 days and 4 seperate support requests with Twitter were completely ignored or immediate closed, I went back to the code. I was actually talking with my friend Jason and saw the “body” of the response was encoded. I pulled it out of the response, output it to the page and found the error: “Failed to validate oauth signature and token”. My first response was, “great, tell me something I didn’t know”.
So, I went back to Google and searched for this error. One of the first results was, “Failed to validate oauth signature and token” on Twitter Oauth – Check Your Clock! My first thought, “Ah crap!”.
I checked my clock, it was about 11 hours off. So I fixed it, using the instructions in the Setting the time of your system article.
I am glad that the solution was simple, frustrated that Twitter was not helpful with their support, and sad that my application I spent so much time on is so dependent on something this silly.
Sphere: Related Content
November 12th, 2009 §
Well, it was this morning. I didn’t realize it until I went to schedule a blog post for 12 hours later and it published immediately. I was concerned and actually went to blame WordPress first (I’m really not sure why). However, when I was looking at the time preferences in the General settings area of the site I noticed something really strange. My timezone was correct, but the date WP was showing was way off. This meant that my CentOs5 server’s time was way off.
I did a little research and found an article called “Setting the time of your system“. They gave me some good solutions on how to fix the issue, after reading it I was ready to go. I tried a couple things in the order they said and found myself a little confused. So naturally, I started trying things till they worked. This is not always the best solution, but I figured I could deal with a timing issue if I messed it up worse than it was.
For my CentOs 5 server I did the following, which actually worked and set the time perfectly.
First, I checked the date the server had, which turned out to be way off.
-
# date
-
Thu Nov 12 23:56:41 MST 2009
Then I looked to see if ntpd (the automatic time adjustment service) was running, it was.
-
# service ntpd status
-
ntpd (pid 12019) is running…
I tried ntpdate to reset the time on the server, but it complained about the socket being in use.
-
# ntpdate 129.6.15.28
-
12 Nov 23:57:28 ntpdate[12045]: the NTP socket is in use, exiting
My solution was to stop ntpd and then run ntpdate again, which worked!
-
# service ntpd stop
-
Shutting down ntpd: [ OK ]
-
-
# ntpdate 129.6.15.28
-
12 Nov 07:25:10 ntpdate[12063]: step time server 129.6.15.28 offset -59562.023808 sec
A simple restart of the ntpd service and the time was correct!
-
# service ntpd start
-
Starting ntpd: [ OK ]
-
-
# date
-
Thu Nov 12 07:25:20 MST 2009
So, the solution was to do the following steps:
-
# service ntpd stop
-
# ntpdate 129.6.15.28
-
# service ntpd start
-
#date
I added “date” on the end, because you want to verify that the time actually did reset. Best of Luck!
Sphere: Related Content