How to add a extention to the php.ini file
Hi have Centos 6 installed and busy installing wkhtmltopdf, I only have one step left and that is to include extension=phpwkhtmltox.so to the php.ini file, I added it to /etc/php.ini and reloaded apache and the extention does not take effect.
I check /usr/lib64/php/modules/phpwkhtmltox.so and the file is present.
Is there anything I did wrong?
When adding an extension to PHP:
-
Ensure you adding it to the correct php.ini file:
- Check the output of
phpinfo();
for the 'Loaded Configuration File' line- see if you are actually using /etc/php.ini
- Alternatively try:
php -i | grep php.ini
- some environments (e.g. FastCGI) may load a different config file, so this isn't always reliable
- Check the output of
php.ini is an INI file - it is divided into sections (with the section names in square brackets). A directive under the wrong section may not be correctly applied. You should add extensions to the '[PHP]' section (typically the first section, it is often followed by sections for 'Module Settings')
-
PHP loads the ini files from /etc/php.d - it is good practise to add the extension from there. Create a new ini file, named after your module, containing the 'extension=' directive, and any module specific configuration options. For example:
echo "extension=phpwkhtmltox.so" > /etc/php.d/phpwkhtmltox.ini
Of course, restart Apache/PHP after you have made the changes, and confirm that they were successful using phpinfo();