6

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?

4
  • Is it spelled correctly in php.ini? - should be extension=...
    – meulop
    Jan 27, 2012 at 14:26
  • @meulop - yes it's like this in php.ini extension=phpwkhtmltox.so
    – Elitmiar
    Jan 27, 2012 at 14:31
  • 1
    It is possible that a different configuration file is being loaded. a) Check the output of phpinfo(); for the 'Loaded Configuration File' line - see if you are actually using /etc/php.ini (or php -i | grep php.ini - although this isn't the same in some environments). You may want to create a new ini file under /etc/php.d and add your line to it (e.g. echo "extension=phpwkhtmltox.so" > /etc/php.d/phpwkhtmltox.ini ) . Finally, don't just add the line to the bottom of php.ini - the file is divided into sections, add it before the Module Settings.
    – cyberx86
    Jan 27, 2012 at 14:46
  • @cyberx86 - Placing a new ini file under /etc/php.d did the trick, thank you for the advice.
    – Elitmiar
    Jan 27, 2012 at 20:34

2 Answers 2

7

When adding an extension to PHP:

  1. 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

  2. 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')

  3. 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();

3
  • 1
    A note on (2) : the default php.ini file found version 5.6.9 of PHP mentions this : "Section headers (e.g. [Foo]) are also silently ignored, even though they might mean something in the future."
    – Nigralbus
    Jul 22, 2015 at 15:36
  • Are you running on Windows or Linux? I CANNOT get XDebug to do squat on Windows! Oct 12, 2017 at 5:35
  • 1
    The above instructions are for Linux (CentOS specifically)
    – cyberx86
    Oct 13, 2017 at 13:30
0

I had a similar issue on Fedora, added to /etc/php.ini

extension=solr.so

restarted httpd with sudo systemctl restart httpd but to no effect. This did it

sudo systemctl restart php-fpm
2
  • your using php-fpm which is independent from your https instance.
    – djdomi
    Feb 27 at 19:54
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – djdomi
    Feb 27 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .