Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support
I don't do too much with php these days, and really haven't since I found rails many years ago. But I figured I would give magento a try, just for fun. Most of it worked, but I continually came across this PCRE error - the full error that I go was:
|
Warning: preg_match_all() [function.preg-match-all]: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support at offset 0 ... |
Ok, loads and loads of research led no where, or at least no where that I was willing to go. I tried so hard to find a solution that didn't require me recompiling apache ... well no such luck. I am using slicehost's ubuntu 8.04, so I took the dpkg approach to help make things simple.
Well, I am sure you have found out by now that apache comes with its own version of pcre built in (version 5). This version does not come with UTF-8 support. The trick is to tell apache to use an external system package of pcre. This requires the slightest bit of reconfiguring of apache.
Initially, my pcre looked like this (notice the version of 5.0...):
As mentioned earlier this is a pretty good indicator that your pcre is the built-in apache version. This is not good.
Ok, the solution is not too bad. Compared to this article, which I learned a few things from, it is much simpler. One thing, you will note in the article is the use of --with-pcre=/usr - this is quite different than the --with-pcre=yes that apache2 comes configured with from gusty.
So the solution is to make that change by doing this:
1) Get the source code:
1 2 3 |
mkdir apache_src cd apache_src/ apt-get source apache2 |
2) Modify the configuration (specifically the AP2_COMMON_CONFARGS in debian/rules)
Once the source is downloaded you should have several files and a directory. Edit the debian/rules files from within the apache directory. The only change that is needed is to find the line that says --with-pcre=yes and change it to say --with-pcre=/usr.
This, of course, assumes that you installed pcre and it lives in /usr/(bin,lib ...):
1 2 |
vi apache2-2.2.4/debian/rules # make those changes ./apache2-2.2.4/debian/rules |
3) Install build dependencies for apache:
|
sudo apt-get build-dep apache2 |
4) Now build the package:
1 2 3 4 |
cd apache2-2.2.4/ # you may need to install fakeroot for this: sudo apt-get install fakeroot dpkg-buildpackage -rfakeroot -uc -b |
5) Install the new apache package:
1 2 |
cd .. sudo dpkg -i apache2_2.2.4-3ubuntu0.1_all.deb |
Voila, now look what I have:
That should be it.
Good luck.