Can we have 2 'extension_dir' in php.ini?

13,259
  1. Because it is the default location when installing via pecl install, while if you compile PHP from source, the extension path should be /usr/local/lib/php/extensions/no-debug-non-zts-20090626.

  2. As far as I know, PHP doesn't support multiple extension_dir, it only pick the last one. Just type php -i | grep eaccelerator to see what happens.

The workaround is copy the extensions to the right path.

Share:
13,259

Related videos on Youtube

Nyxynyx
Author by

Nyxynyx

Hello :) These days its web development: PHP, Codeigniter, node.js, Javascript, jQuery, MySQL, mongoDB, HTML/CSS

Updated on September 18, 2022

Comments

  • Nyxynyx
    Nyxynyx almost 2 years

    When I installed pdo-pgsql, the extension was installed into /usr/lib/php/extensions/no-debug-non-zts-20090626/ and thus not automatically loaded. In php.ini, I have extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626" already defined.

    Snippet of php.ini

    ; Directory in which the loadable extensions (modules) reside.
    extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
    zend_extension = "/usr/local/IonCube/ioncube_loader_lin_5.3.so"
    zend_extension = "/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so"
    extension = "eaccelerator.so"
    extension = "pdo.so"
    extension = "pdo_pgsql.so"
    extension = "pdo_sqlite.so"
    extension = "sqlite.so"
    extension = "pdo_mysql.so"
    

    Modified to work

    ; Directory in which the loadable extensions (modules) reside.
    extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
    extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626"
    zend_extension = "/usr/local/IonCube/ioncube_loader_lin_5.3.so"
    zend_extension = "/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so"
    extension = "eaccelerator.so"
    extension = "pdo.so"
    extension = "pdo_pgsql.so"
    extension = "pdo_sqlite.so"
    extension = "sqlite.so"
    extension = "pdo_mysql.so"
    
    1. Why did PECL install pdo-pgsql into the 2nd extension directory and not the first?

    2. Is it recommended to have 2 extension_dir as shown in the 2nd code snippet above?

  • Juris Malinens
    Juris Malinens almost 12 years
    or make symlinks...
  • Nyxynyx
    Nyxynyx almost 12 years
    Is this how I should make the symlinks? : ln -s /usr/lib/php/extensions/no-debug-non-zts-20090626 /usr/php/extensions/no-debug-non-zts-20090626
  • Greg Petersen
    Greg Petersen almost 12 years
    It should be: ln -s /usr/local/lib/php/extensions/no-debug-non-zts-20090626 /usr/lib/php/extensions/no-debug-non-zts-20090626. But rename it first: mv /usr/lib/php/extensions/no-debug-non-zts-20090626 /usr/lib/php/extensions/no-debug-non-zts-20090626.bak.
  • Nyxynyx
    Nyxynyx almost 12 years
    Why would you renname it first?
  • Greg Petersen
    Greg Petersen almost 12 years
    what happens if you link to a existing directory?