没有不值得去解决的问题,也没有不值得去学习的技术!

Analyze and Resolve the PHP Fatal Error: require() Failed Opening Required ‘mcloudwwwcmcp-apivendorcomposer..myclabsdeep-copysrcDeepCopydeep_copy.php’

Checked the Nginx error log: PHP message: PHP Fatal error: require(): Failed opening required '/mcloud/www/cmcp-api/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php'.

1. Checked the Nginx error log: PHP message: PHP Fatal error: require(): Failed opening required ‘/mcloud/www/cmcp-api/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php’. As shown in Figure 1.

Checked the Nginx error log: PHP message: PHP Fatal error: require(): Failed opening required '/mcloud/www/cmcp-api/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php'.
Figure 1

2. Checked the files on Gitlab and found that the directory: /vendor/composer/../myclabs/deep-copy is an empty directory. As shown in Figure 2.

Checked the files on Gitlab and found that the directory: /vendor/composer/../myclabs/deep-copy is an empty directory.
Figure 2

3. Deleted the \vendor\myclabs\deep-copy\.git directory. As shown in Figure 3.

Deleted the \vendor\myclabs\deep-copy\.git directory.
Figure 3

4. Selected the corresponding files and added them. As shown in Figure 4.

Selected the corresponding files and added them.
Figure 4

5. Committed. As shown in Figure 5.

Committed.
Figure 5

6. All – Commit – Push. As shown in Figure 6.

All - Commit - Push.
Figure 6

7. Checked the files on Gitlab and found that the corresponding files already exist under the directory: /vendor/composer/../myclabs/deep-copy. As shown in Figure 7.

Checked the files on Gitlab and found that the corresponding files already exist under the directory: /vendor/composer/../myclabs/deep-copy.
Figure 7

8. An error occurred while building the image: Step 4/7 : COPY code /mcloud/www/cmcp-api. Error processing tar file(exit status 1): open /vendor/myclabs/deep-copy/fixtures/f005/Foo.php: no such file or directory. As shown in Figure 8.

An error occurred while building the image: Step 4/7 : COPY code /mcloud/www/cmcp-api. Error processing tar file(exit status 1): open /vendor/myclabs/deep-copy/fixtures/f005/Foo.php: no such file or directory.
Figure 8

9. Checked the files on Gitlab and found that the file: /vendor/myclabs/deep-copy/fixtures/f005/Foo.php exists. As shown in Figure 9.

Checked the files on Gitlab and found that the file: /vendor/myclabs/deep-copy/fixtures/f005/Foo.php exists.
Figure 9

10. Built again, and the build succeeded. As shown in Figure 10.

Built again, and the build succeeded.
Figure 10

11. Similar issues still occurred afterwards. As follows:

12. Searched for .git in the /vendor directory and found dozens of .git directories. Finally decided to delete /vendor, run composer install to reinstall, and then delete the .git directory in each directory. Committed and pushed again. As shown in Figure 11.

Searched for .git in the /vendor directory and found dozens of .git directories. Finally decided to delete /vendor, run composer install to reinstall, and then delete the .git directory in each directory. Committed and pushed again.
Figure 11
Plaintext

PHP message: PHP Fatal error:  require(): Failed opening required '/mcloud/www/cmcp-api/vendor/composer/../paragonie/random_compat/lib/random.php'

PHP message: PHP Fatal error:  require(): Failed opening required '/mcloud/www/cmcp-api/vendor/composer/../guzzlehttp/promises/src/functions_include.php'

13. Checked the Nginx error log, and no more errors were reported. This is as expected.

14. Referenced Should I commit the dependencies in my vendor directory?: https://docs.phpcomposer.com/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.html . I adopted the third option. Actually, I feel that adopting the fourth option would involve relatively less work. As shown in Figure 12.

Referenced Should I commit the dependencies in my vendor directory?: https://docs.phpcomposer.com/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.html . I adopted the third option. Actually, I feel that adopting the fourth option would involve relatively less work.
Figure 12

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系