Why does PHP not find ini files even though it scanned the directory they’re in?

I’m trying to run composer install but it’s not finding my extensions. It suggests I run php --ini as a debug step, and it reports “(none)” additional .ini files parsed:

  - Running `php --ini`

      Loaded Configuration File:         /my_dir/etc/php/php.ini
      Scan for additional .ini files in: /my_dir/etc/php/conf.d

      Additional .ini files parsed:      (none)

But when you look at that directory there are clearly additional .ini files in there:

  - Running `ls -1 /my_dir/etc/php/conf.d`

      000-my.ini
      010-ext-zend_opcache.ini
      100-ext-gmp.ini
      110-ext-imap.ini
      120-ext-intl.ini
      130-ext-ldap.ini
      140-ext-raphf.ini
      150-ext-pq.ini
      160-ext-redis.ini
      170-ext-sqlite3.ini

Any ideas why PHP isn’t finding the .ini files in the directory it claims it’s looking in? What other debugging information could I provide?

Debugging output

The files exist and is loadable:

  - Running `php -c /my_dir/etc/php/conf.d/000-my.ini --ini`

      Loaded Configuration File:         /my_dir/etc/php/conf.d/000-my.ini
      Scan for additional .ini files in: /my_dir/etc/php/conf.d

      Additional .ini files parsed:      (none)

But another file gave me an error as it couldn’t load the so. I think that’s the problem:

Warning: Failed loading Zend extension 'opcache.so' 
(tried: /does/not/exist/php/lib/php/extensions/no-debug-non-zts-20230831/opcache.so 
(/does/not/exist/php/lib/php/extensions/no-debug-non-zts-20230831/opcache.so: 
cannot open shared object file: 
No such file or directory), /does/not/exist/php/lib/php/extensions/no-debug-non-zts-20230831/opcache.so.so 
(/does/not/exist/php/lib/php/extensions/no-debug-non-zts-20230831/opcache.so.so: 
cannot open shared object file: 
No such file or directory)) in Unknown on line 0

Thanks Alex Howansky. Please upvote the comment that suggested this debug method.