Welcome Guest, Not a member yet? Register   Sign In
Multiple Applications
#1
Question 

Hello there...
I try to setup multiple applications and I followed the instructions on http://codeigniter.com/user_guide/genera..._apps.html .
The only thing I had to change was in this file: 

Code:
mySubFolder/app/Config/Paths.php
There I change one row from:

PHP Code:
public $systemDirectory __DIR__ '/../../vendor/codeigniter4/framework/system'
to
PHP Code:
public $systemDirectory __DIR__ '/../../../vendor/codeigniter4/framework/system'
...and it works.

Now I want to have composer-support and I change in the file:
Code:
mySubFolder/app/Config/Constants.php
the row
PHP Code:
defined('COMPOSER_PATH') || define('COMPOSER_PATH'ROOTPATH 'vendor/autoload.php'); 
to
PHP Code:
defined('COMPOSER_PATH') || define('COMPOSER_PATH'ROOTPATH '../vendor/autoload.php'); 
like explained in the guide.
But then I get following error:
Code:
Fatal error: Uncaught TypeError: Argument 1 passed to CodeIgniter\CodeIgniter::__construct() must be an instance of Config\App, null given, called in C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\Services.php on line 139 and defined in C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\CodeIgniter.php:147 Stack trace: #0 C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\Services.php(139): CodeIgniter\CodeIgniter->__construct(NULL) #1 C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\BaseService.php(248): CodeIgniter\Config\Services::codeigniter(NULL, false) #2 C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\BaseService.php(189): CodeIgniter\Config\BaseService::__callStatic('codeigniter', Array) #3 C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\Services.php(134): CodeIgniter\Config\BaseService::getSharedInstance('co in C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\CodeIgniter.php on line 147

How could I fix this error ?!?
Reply
#2

See C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\Services.php on line 139
Reply
#3

(04-12-2022, 06:21 PM)kenjis Wrote: See C:\xampp\htdocs\kighwebapps\ci4-projects\vendor\codeigniter4\framework\system\Config\Services.php on line 139

You are funny ....

The line is

PHP Code:
return new CodeIgniter($config); 

but I can't find the solution for the error in my initial post above, when I fix the composer path described in the manual "Running Multiple Applications with one CodeIgniter Installation" from
PHP Code:
defined('COMPOSER_PATH') || define('COMPOSER_PATH'ROOTPATH 'vendor/autoload.php'); 
to
PHP Code:
defined('COMPOSER_PATH') || define('COMPOSER_PATH'ROOTPATH '../vendor/autoload.php'); 

Greetings...

Kighlander
Reply
#4

The error message says the $config's value is null.
Why?
Reply
#5

(04-12-2022, 11:09 PM)kenjis Wrote: The error message says the $config's value is null.
Why?

If I know why I would not ask for a solution of this problem  Wink

I only want to have multiple Application with ONE ci4-installation. And I followed the instructions described in the guide. And it works fine UNTIL I wand to change the composer-part...
I' using xampp local and an apache2-server online. I use virtual hosts pointed to the public-folder of each installation.
Reply
#6

It seems the line `$config ??= config('App');` sets null to $config.
It means `config('App')` can't find Config\App.php.
Reply
#7

(04-13-2022, 02:06 AM)kenjis Wrote: It seems the line `$config ??= config('App');` sets null to $config.
It means `config('App')` can't find Config\App.php.

I don't want to disagree with you, but this error only appears when I change the "Constants.php" file as the instructions say.

If I do NOT change the file, then CodeIgniter works, but I then miss the Composer component (e.g. for addins from other developers).
Reply
#8

Okay, the first thing you do is to check the path is correct.

ROOTPATH . '../vendor/autoload.php'

Is that really correct?
The instruction in the user guide is an example. If you have different folder structure, it is not correct to you.
Reply
#9

(04-13-2022, 05:10 AM)kenjis Wrote: Okay, the first thing you do is to check the path is correct.

ROOTPATH . '../vendor/autoload.php'

Is that really correct?
The instruction in the user guide is an example. If you have different folder structure, it is not correct to you.

With clean installation, the line 26 of the "Constants.php" looks like this:
PHP Code:
/*
 | --------------------------------------------------------------------------
 | Composer Path
 | --------------------------------------------------------------------------
 |
 | The path that Composer's autoload file is expected to live. By default,
 | the vendor folder is in the Root directory, but you can customize that here.
 */
defined('COMPOSER_PATH') || define('COMPOSER_PATH'ROOTPATH 'vendor/autoload.php'); 
... and the app works...
But if I change the path to
PHP Code:
ROOTPATH '../vendor/autoload.php'); 
... I get the error I posted in the initial post of this thread.

I want to install "Tatter Lightweight settings", but nothing happend. Composer said "installed" but if I followed the rest of installation the files were not there, where they should be.
In this case,  the guide of multiple application says that I have to modify the "Constants.php" ... and after that the app was not working with the error above...
Reply
#10

(This post was last modified: 04-13-2022, 04:34 PM by kenjis.)

Check the path is correct.

PHP Code:
echo COMPOSER_PATH; exit; 


By the way, why do you want to use Multiple Applications?
It seems there is no particular merit in that configuration.

Just installing two appstarter is easy and simple, and
it could reduce the upgrade costs.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB