It’s been several months that I’m developing on my Slackware box and one of the PHP framework I’m using is Kohana. I was shocked that when I run the Kohana install test, my system did not pass the requirements. It is because my PCRE was not compiled with UTF-8 support. It is not really a problem with PHP but with PCRE itself.
What Package Should I Recompile?
I first asked at LinuxQuestions on how to deal with the problem. First I though I need to recompile PHP but after testing it on the Virtual Machine, it seems that I’m compiling the wrong package.
What I need to re-compile is the PCRE library package.
So what I did was make sure I have the source. Since I’m syncing the current tree to my Virtual Machine’s Slackware in the office, I have all the Slackware source including PCRE. All I need to do is edit pcre.SlackBuild and look for the line that reads:
CFLAGS="$SLKCFLAGS" \ ./configure \ --enable-utf8 \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man
Especially the line for ./configure
since that is the most common way source codes are configured in Linux. I need to make sure these lines are added:
--enable-utf8 \ --enable-unicode-properties \
Since --enable-utf8
is already present, I just add the --enable-unicode-properties
. After that, I modified this line:
BUILD=${BUILD:-1}
I modified the build number from 1 to 2 so that it will properly upgrade the old package with my re-compiled package.
Running slackbuild script
After modifying the script (and saving it) the next step is to rebuild it. Of course we must be in the directory where these files are located. To start building, simply: (Be sure you are root via su -
)
./pcre.SlackBuild
The final package will be saved in /tmp
. Mine was named pcre-8.02-i486-2.txz
.
Next we will upgrade the old package. (Be sure you are root)
upgradepkg /tmp/pcre-8.02-i486-2.txz
Finally
Now that we have finally rebuilt our PCRE package, we will restart our web server. Do this as root:
/etc/rc.d/rc.httpd restart
If in doubt, you can simply restart the machine. After all these, Kohana install test should pass by now. Since I got the package compiled in my Virtual Machine, all I have to do is bring the package at home and install. No more compiling at home.
Flawless!