PHP5 on CentOS

Posted by Quinn at July 10th, 2007 12:40pm under web 1 Comment Permalink

I had some fun playing with CentOS4. I am kind of new to rpm and yum, so I thought I should make some notes.

Support GoPHP5.org

It is time to go PHP5. I am so happy to see the movement. Unfortunately, I had a box of CentOS4 came with PHP4 installed. Yes, I was obsessed to make a change to the box.

I had to install yum first. I had to get some dependencies as well, so here is what I did.

#wget http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm
#wget http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm
#wget http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm
#wget http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm
#wget http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/yum-2.4.3-3.el4.centos.noarch.rpm

# rpm -ivh sqlite-3.3.6-2.i386.rpm
# rpm -ivh python-sqlite-1.1.7-1.2.1.i386.rpm
# rpm -ivh python-elementtree-1.2.6-5.el4.centos.i386.rpm
# rpm -ivh python-urlgrabber-2.9.8-2.noarch.rpm
# rpm -ivh yum-2.4.3-3.el4.centos.noarch.rpm

Now yum is ready. But, when I went..

# yum update --enablerepo=centosplus php

I got errors of dependency conflicts. Then, I found this, which explains the issue of upgrading to PHP5 with yum.

Here was the solution.

# vi /etc/yum.repos.d/CentOS-Base.repo

[base]
exclude=php* kernel* postfix*
[update]
exclude=php* kernel* postfix*
[centosplus]
exclude=php-xml php-domxml

I am not sure if this one above actually helped. But removing php-domxml like below was a MUST. Then, it came through.

# rpm -e --nodeps php-domxml
# yum update --enablerepo=centosplus mysql php

This upgraded all MySQL and PostgreSQL as well. If the server was hosting real websites, I should to be more careful though. Anyway, I then added some of those and I'm happy now.

http://centos.arcticnetwork.ca/4/centosplus/i386/RPMS/php-xml-5.1.6-3.el4s1.7.i386.rpm
http://centos.arcticnetwork.ca/4/centosplus/i386/RPMS/php-xmlrpc-5.1.6-3.el4s1.7.i386.rpm

Apache and RoR

Posted by Quinn at July 9th, 2007 12:47am under web 0 Comments Permalink

This is about how to set up web server to run RoR with Apache in front.

I am hosting several domains with Apache and its VirtualHost directories. I was wondering if I could run Rails with the same server and the same port. Yes, I knew the anwer was mod_proxy but never tried before. Well, that had to change. Here is what I came up this time. It was pretty easy and nice.

There is no mod_proxy package/port for FreeBSD. I had to recompile Apache2.0 with this configuration.

echo "WITH_PROXY_MODULES=yes" >> /etc/make.conf

Then, I did.

portupgrade -f apache2

Easy way, huh? But if you don't have portupgrade, you may have to do..

# cd /usr/ports/www/apache20
# make deinstall
# make install clean

Then, I added these lines in the apache config file.

# vi /usr/local/etc/apache2/httpd.conf
LoadModule proxy_module       libexec/apache2/mod_proxy.so
LoadModule proxy_ftp_module       libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module      libexec/apache2/mod_proxy_http.so
LoadModule proxy_connect_module   libexec/apache2/mod_proxy_connect.so

Make a new Rails app.

$ mkdir -p /path/to/application
$ rails /path/to/application
$ cd /path/to/application
$ mongrel_rails start -d

Lastly, mod_rewrite does the rest with [p] flag.

$ cd /path/to/application
$ vi .htaccess
RewriteEngine   on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule     (.*) http://localhost:3000/$1 [P]

Now, I can access to the Rails application without specifying the port number but a url to the directory just like the others. In this way, I don't have to reconfigure the router to open the ports every time I start new RoR. Cool. Isn't it?

Tai (Red Snapper) Fishing

Posted by Quinn at July 6th, 2007 11:23am under hearts 0 Comments Permalink

Red Snapper I was gone fishing last weekend. I used to go fishing alot since I was a kid, but it was not happening that often last few years. So, finally, I kind of FORCED myself to GO! : ) Anyway, it went good. I actually caught some Tai (Red Snapper), brought them home, and fed my family. We ate some in raw slices (Sashimi), soup, and baked. That was all delicious!

Trying Babelgum

Posted by Quinn at June 9th, 2007 11:20am under web 2 Comments Permalink

I just bumped into Babelgum, an internet TV, video, movie broadcaster. I just installed the beta application to my Windows XP machine and watching the shows right now. I usually don't use my Windows machine any more than just testing browser compatibilities for websites I make. However, this is looking so fantastic! Actually, I just can't wait Joost to come with a Mac client, which is probably very soon. If you are interested in Babelgum, I think this page is the right place to start.