1

I wrote my extension.

Ubuntu system.

php -c "/etc/php5/apache2/php.ini" -r "echo extension_loaded('my');"
 => 1 OK!

But under apache - nothing!

echo extension_loaded('my'); 
=> "" 

Why?

Php ini shows:

"Loaded Configuration File /etc/php5/apache2/php.ini"

6
  • Check if your extension is loaded using extension_loaded() Commented Jul 11, 2013 at 10:29
  • I wrote.. but not loaded Commented Jul 11, 2013 at 10:37
  • stackoverflow.com/questions/1724511/… Commented Jul 11, 2013 at 10:59
  • 2
    Did you restart/reload Apache? PHP in Apache caches the INI file in the module until Apache is reloaded. Commented Jul 14, 2013 at 20:06
  • Did you build the extension with your PHP version or got it from other sources? Commented Aug 27, 2013 at 9:54

2 Answers 2

1

I always put my extensions in separate files and place them inside

/etc/php5/apache2/conf.d/

suppose I wanted to load mongo php extension, i would perform the following steps:

sudo pecl install mongo

and once that is completed successfully, I would make a

echo "extension=mongo.so" | sudo tee /etc/php5/apache2/conf.d/mongo.ini

after that I would reload or restart the server

sudo service apache2 restart

Sign up to request clarification or add additional context in comments.

Comments

0

I got the same problem, and I think the issue is what the extension path is relative to when running under apache.

The default setting

extension_dir = "ext"
works in CLI because PHP is called directly.

When running under apache i got it to work when specified the absolute path with forward slashes:

extension_dir = "c:/php/ext"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.