0

I upgraded an old PHP application with Zend framework from PHP 5.2 to PHP 8.2 using Rector. Now Its giving me an error as follows,

Fatal error: Uncaught Error: Failed opening required 'D:\projects\my_project\public/Zend/Application.php'

The error is triggerd by the following line in the index.php file,

require_once __DIR__.'/Zend/Application.php';

This require_once method worked in the earlier version and gave out path as,

D:/projects/library/Zend/Application.php

The upgraded project gives out the path as,

D:\projects\my_project\public/Zend/Application.php

making it unable to locate the Application.php file.

I echoed the value of "DIR" and its "D:\projects\my_project\public" in both instances.

  • 1
    And what is your question? – Your Common Sense May 19 '23 at 11:11
  • `__DIR__` is the location of the file, regardless of the version of PHP. – shingo May 19 '23 at 11:12
  • @YourCommonSense What exactly I need to do to get the correct path? I tried giving absolute path as "require_once D:/projects/library/Zend/Application.php". This gives the same error in another file where "require_once __DIR__." is used. – HARINDA VITHANA May 19 '23 at 11:32
  • I assume `D:/projects/library/Zend/Application.php` definitely still exists, then? – ADyson May 19 '23 at 11:42
  • 1
    You need to provide the correct path. Which path is correct is only known to you. Looks like you moved your entire project from D:\projects\my_project to D:\projects\my_project\public, but that's just a guess. – Your Common Sense May 19 '23 at 11:47

0 Answers0