• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't get CI4 to run :|

Not new to CI - built many apps on CI3 but felt this was a new project and time to update to CI4.

I'm using composer to manage dependencies, and have everything running locally, using the appstarter route, and spark runs fine.

Remotely, all I get is 500 errors.

Remote server is ubuntu 18.04, apache, php 7.4. Intl php ext has been enabled.

Filestructure (contents of /var/www/html/<folder>/):

drwxrwxr-x  4 www-data www-data    4096 Sep 15 15:10 .
drwxr-xr-x 12 root    root        4096 Sep 15 13:30 ..
-rw-rw-r--  1 www-data www-data    1109 Sep 15 15:10 bitbucket-pipelines.yml
-rw-rw-r--  1 www-data www-data    115 Sep 15 15:10 composer.json
-rw-rw-r--  1 www-data www-data  36881 Sep 15 15:10 composer.lock
-rw-rw-r--  1 www-data www-data 2167319 Sep 15 15:10 composer.phar
drwxrwxr-x  7 www-data www-data    4096 Sep 15 15:34 project-root
-rw-rw-r--  1 www-data www-data      20 Sep 15 15:10 README.md
drwxrwxr-x 13 www-data www-data    4096 Sep 15 15:10 vendor

VHost setup:
<VirtualHost *:80>
  ServerName <domain.com>
  <Directory /var/www/html/<folder>/project-root/public/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/<folder>/project-root/public/

Error reported in apache error log:
[Tue Sep 15 15:53:21.388692 2020] [php7:error] [pid 28090] [client] PHP Fatal error:  require(): Failed opening required '/var/www/html/<folder>/project-root/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/php') in /var/www/html/<folder>/project-root/public/index.php on line 36

This seems to indicate that the VHost setup is at least working, in that when the domain url is hit it's getting through to CI, but CI then falls over for reasons, and I'm at a loss, since the bootstrap.php file is where it's failing to be found.

Try adding this to your vhost not sure if that is your problem but worth the try.

ServerName http://www.Your_server.com
ServerAlias http://www.Your_server.com
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Dear lord, after losing an afternoon to this and finally posting to ask for help, I solved my own problem. Hopefully this might help someone else...

The issue was that the vendor folder was being put by composer at the root of the <folder>, NOT inside the project-root folder. Doh.

By adding the following you can explicitly tell composer where to locate the vendor folder, and then all was well with the world:
  "config": {
    "vendor-dir": "project-root/vendor/"
  "require": ...

Can you check your Config\Paths file? It seems to me that the path to your system directory is not correctly set.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.