Reputation: 329
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"
Upvotes: 1
Views: 4568
Reputation: 163
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"
Upvotes: 0
Reputation: 93
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
Upvotes: 1