8

I am compiling php, and its setting my modules directory to /usr/lib64/20090626-zts

I would like to change this to /usr/lib64/php/modules, but I cannot find a configuration option to do so.

I can change it in my php.ini and move the directory, but when I run phpize and make a new module it still puts it in /usr/lib64/20090626-zts

  • Haven't have time to test this: EXTENSION_DIR=/usr/lib64/php/modules phpize. – Mark Wagner Sep 27 '11 at 23:54
4

I would suggest making /usr/lib64/php/modules a symlink to the folder with the ID. This prevents mixing extensions from different versions of PHP in the long run.

Besides that: You should be able to set it by setting EXTENSION_DIR as environment variable before running PHP's configure. something like

 $ EXTENSION_DIR=/my/location ./configure --with-some-extension
  • Yeah that makes sense, I don't want my modules to conflict in the future. I think I will just leave the folder name alone. – copacetic Sep 28 '11 at 16:09
8

Check the current extension directory with:

php-config --extension-dir

and you can change it by setting extension_dir in php.ini:

extension_dir="/usr/lib64/php/modules"

Don't forget to restart Apache.

0

My issue was not identical, but since this question was the first to pop up with answers that were ultimately very helpful, I will add my comments.

I was having trouble getting PHP (under Centos7 running in a docker container) to use MySQL due to directory configuration - although I was using pre-built binaries and not compiling anything. Although the various pdo and mysqlnd.so modules and .ini files were installed in my container (just using standard yum install php72 and all the other stuff specified in the PHP install wizard), they were not in the default places that PHP was looking for them. I have no idea why. Maybe it's some kind of docker thing?

Anyway, to solve the issue I had to echo an extension_dir directive to my PHP.ini and ALSO set the PHP_INI_SCAN_DIR env variable. These are the relevant commands from my Dockerfile

ENV PHP_INI_SCAN_DIR=/etc/php.d/
RUN echo 'extension_dir = "/usr/lib64/php/modules"' >> /etc/opt/remi/php72/php.ini

I hope this doesn't result in getting module conflicts later down the track as @johanes warns.

  • > "they were not in the default places. " You didn't follow the wizard instructions properly, choosing "single version", everything in installed in default places. SCL use different paths to allow multiple versions. – Remi Collet Feb 14 at 10:22
  • @RemiCollet thanks for the response. I chose single version from the wizard - which is what I think I want since I only want one version of PHP on my container. The only part of the wizard instructions that I didn't add in my dockerfile was ` yum --enablerepo=remi-php72-test install php-xxx` and yum update. Am I missing something here? – charlesdeb Feb 16 at 8:06
  • These latest commands are for test packages, and for additional extension (replace xxx by the name of the extension you want) – Remi Collet Feb 16 at 8:10
  • @RemiCollet Sorry, I must be a bit dumb. Are you saying that if use the test packages this will fix my problem of the mysql modules not going into the .../remi/... folders? – charlesdeb Feb 16 at 8:17
  • 1
    I say that php-* packages (single version) use standard paths, and php72-php-* (SCL, multiple versions) use /opt/remi. See blog.remirepo.net/pages/English-FAQ#scl – Remi Collet Feb 17 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.