PHP Warning Require Vendor
PHP Warning require vendor codeigniter4 framework – In this article I will share the solution to the error I got. The current condition is when I get the codeigniter 4 code from my friend and I want to run it on my local.
The error I get is as follows:
neon@pop-os:~/Documents/my-project$ php spark serve
PHP Warning: require(/home/neon/Documents/my-project/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php): Failed to open stream: No such file or directory in /home/neon/Documents/my-project/spark on line 45
PHP Fatal error: Uncaught Error: Failed opening required '/home/neon/Documents/my-project/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/php') in /home/neon/Documents/my-project/spark:45
Stack trace:
#0 {main}
thrown in /home/neon/Documents/my-project/spark on line 45
Causes of Errors Occur and How to Fix It?
The cause of the error is that the vendor folder is not available in our project. Therefore, to fix the error is to reinstall composer.
The command I use is:
composer install --ignore-platform-reqs
After install, you should be able to run php spark serve. However, if you get an error like the following:
neon@pop-os:~/Documents/my-project$ php spark serve
[Error]
Call to undefined function CodeIgniter\locale_set_default()
at SYSTEMPATH/CodeIgniter.php:181
Backtrace:
1 SYSTEMPATH/bootstrap.php:146
CodeIgniter\CodeIgniter()->initialize()
2 ROOTPATH/spark:45
require('/home/neon/Documents/my-project/vendor/codeigniter4/framework/system/bootstrap.php')
Then the command to fix the error is to use the following command:
sudo apt install php8.0-intl
* I am using PHP version 8.0, replace it with the version you are using.
Hopefully this article is useful.