Question

I'm going to move codeigniter project from my computer to a public server (virtual private server where it has Cpanel installed in it).

In the public server I got the error :

Message: preg_match(): Compilation failed: unknown option bit(s) set at offset 0

You can check here.
After checking some other related questions, I can see that its because of the PCRE library used by the virtual private server is too old or it has no utf-8 support in it.
The PCRE used version is 7.8. To see the phpinfo of my virtual server click phpinfo here.

Now, I know I CAN solve this by rebuilding pcre, php, etc. But my boss insist to use this registered virtual server, which only give me limited permissions. Only CPANEL account and FTP to upload/remove files

So the question is :
- Is CodeIgniter MUST has this PCRE enabled to run ?
- Is there any other workaround to make it run in the server ?

I already contacted the support, and they said, their CPanel ONLY support PCRE version 7.8 for the current moment. I'm confused, what this has to do with Cpanel ? Aren't it is just supposed to rebuild the PCRE library and let php config direct to it ? I mean Cpanel only GUI right ?

Any help is really appreciated.

Was it helpful?

Solution

I suggest you edit the /system/core/Utf8.php file.

On line 44 put an @ in front of preg_match.

This should at least suppress the error message and allow the script to continue.

Original:

    function __construct()
    {
        log_message('debug', "Utf8 Class Initialized");

        global $CFG;

        if (
            preg_match('/./u', 'é') === 1                   // PCRE must support UTF-8

Modified:

    function __construct()
    {
        log_message('debug', "Utf8 Class Initialized");

        global $CFG;

        if (
            @preg_match('/./u', 'é') === 1                  // PCRE must support UTF-8
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top