Newbie here - just upgrade from zend to laminas but getting Fatal error: Uncaught Error: Failed opening required 'File/Iterator/Autoload.php'


I am a bit flustered and confused about laminas - my problem.

macOS M2 MacBook Pro

I used the standard migration tool. Migrate to Laminas

It went really well. I have PHP 8.1.19 installed and a phpinfo.php display the correct things in the browser

However when I go to my (large) PHP project I get

Warning : require_once(File/Iterator/Autoload.php): Failed to open stream: No such file or directory in /private/var/opt/projects/asapp/web/vendor/phpunit/phpunit/PHPUnit/Autoload.php on line 45

Fatal error : Uncaught Error: Failed opening required ‘File/Iterator/Autoload.php’ (include_path=‘/private/var/opt/projects/asapp/web/vendor/phpunit/phpunit:/private/var/opt/projects/asapp/web/vendor/symfony/yaml:/private/var/opt/projects/asapp/web/vendor/phpunit/phpunit-mock-objects:/opt/homebrew/Cellar/php@8.1/8.1.19/share/php@8.1/pear/’) in /private/var/opt/projects/asapp/web/vendor/phpunit/phpunit/PHPUnit/Autoload.php:45 Stack trace: #0 /private/var/opt/projects/asapp/web/vendor/composer/autoload_real.php(45): require() #1 /private/var/opt/projects/asapp/web/vendor/composer/autoload_real.php(49): {closure}(‘d4cec4c1ab59bc8…’, ‘/private/var/op…’) #2 /private/var/opt/projects/asapp/web/vendor/autoload.php(25): ComposerAutoloaderInit8c5b110dca241f2a69afac80dcbe761e::getLoader() #3 /private/var/opt/projects/asapp/web/init_autoloader.php(21): include(‘/private/var/op…’) #4 /private/var/opt/projects/asapp/web/public/index.php(46): require(‘/private/var/op…’) #5 {main} thrown in /private/var/opt/projects/asapp/web/vendor/phpunit/phpunit/PHPUnit/Autoload.php on line 45

Didn’t find much on stack overflow so making my first appearance here.

Any one have any pointers

Thanks in Advance!

Dr Gerard Hammond, Australia

Hi @Docabilly,

If a doctor can’t solve this problem then will going too? I’m crying right now. What a world in which we’re living in. But all sarcasm aside have you tried removing PHPUnit from Composer and run the Composer install again to check what happens? I’ve not seen PHPUnit causing a problem with execution. But your gigantic code with trillions of lines may have something which can use PHPUnit on the browser.

1 Like

Thank you. Yes I think I could probably comment out the phpunit thingy. I saw on another thread that I should upgrade zend v2 to v3 then do the laminas migrate again. I’lll try that first. Thanks