php extension not loading in MAMP

1.2k views Asked by At

i am using MAMP server i am trying load a extension in my php but i am getting error, i tried everything but i cant make it load :(.

i am using mac os and php 5.6.7

that line is for the extension: extension=protocolbuffers.so

i inserted in: Applications/MAMP/bin/php/php5.6.7/conf/php.ini

i inserted too in: /Applications/MAMP/conf/php5.6.7/php.ini

and still not loading.

i run that php file called: extension.php to see if my extension is loading. so i got the error so i definitely not loading the extension:

Fatal error: Call to undefined function dl() in /Applications/MAMP/htdocs/ci-match/extension.php on line 3

    <?php
if (!extension_loaded('protocolbuffers')) {
    if (!dl('protocolbuffers.so')) {
        exit;
    }
}
?>

i use too php print_r(get_loaded_extensions()); ?>

but i cant see my extension there, how can u guys help me to load that extension?

can you guys help me with that? thank you.

1

There are 1 answers

1
Blizz On

Besides the fact that the dl()-function has been removed completely from a number of SAPIs, it usually is disabled for security reasons. I'm not sure whether the disable will result in an undefined function error or in a security error of some kind. Guess you'll have to find out.

You can control access to it using the enable_dl-directive in php.ini and by making sure safe mode is not enabled.

As for your attempts to load the extension:
I WOULD run a .php file with phpinfo(); in. That will tell you which .ini files are being loaded and where the extension directory is.

You can then use that information to add it in the correct location. Chances are that your MAMP loads from a weird location.

It's very hard to diagnose issues like that remotely.