Search code examples
phpmacospermissionsmacos-sierraintl

PHP Extension intl permission on macOS


I installed PHP extension INTL using Homebrew.

This is my code to test it

if (extension_loaded('intl')) {
    die('SUCCESS! The intl extension is enabled!');
} else {
    die('OOPS! The intl extension is not enabled!');
} 

In CLI after executing this code I get SUCCESS! The intl extension is enabled!

But in browser OOPS! The intl extension is not enabled!

I think it might be a permission problem. I don't use MAMP.


Solution

  • Ensure you edited all php.ini used. In most distros cli, HTTPd module and CGI version have separate php.ini file. Simplest way to deal with it is to run

    <?php
    phpinfo();
    

    and check what php.ini it points to. And then edit as needed.

    I think it might be a permission problem

    httpd's error log as good start to confirm that, yet don't think it's the culprit in your case.