Daksham
Daksham

Reputation: 77

CodeIgniter -> php spark serve Not Working

I have just created a new project with CodeIgniter. I tried to run this command to run the server:

php spark serve

But it is giving me this error:

PHP Warning:  require(/mnt/e/dev/learning/php/codeigniter/001/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in /mnt/e/dev/learning/php/codeigniter/001/spark on line 44
PHP Fatal error:  require(): Failed opening required '/mnt/e/dev/learning/php/codeigniter/001/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/php') in /mnt/e/dev/learning/php/codeigniter/001/spark on line 44

How can I run this command

Upvotes: 3

Views: 52205

Answers (2)

Melroy van den Berg
Melroy van den Berg

Reputation: 3215

In my case I tried to upgrade my CI setup, and all files I didn't adapt I thought I could easily copy them to retrieve the latest file. Like: cp vendor/codeigniter4/framework/app/Config/Constants.php ./app/Config/

However, I did the same for the app/Config/Paths.php file, but that resulted in your error message as well.

Bottom-line: don't try to replace the Paths.php file from upstream. And the $systemDirectory variable in Paths.php should look like this:

public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';

Upvotes: 0

Musaddiq Khan
Musaddiq Khan

Reputation: 1937

PHP version 7.2 or newer is required, with the intl extension and mbstring extension installed. The following PHP extensions should be enabled on your server: php-json, php-mysqlnd, php-xml

And then follow below steps to install and run CI 4 project:

  • composer create-project codeigniter4/appstarter project-root
  • composer clearcache
  • composer update
  • Config Setting:baseUrl in app/Config/App.php and DB info in app/Config/Database.php
  • php spark serve

Note: clear composer cache before updating composer. For detail info follow CI documentation

Upvotes: 10

Related Questions