just today I opened this hosting (at serverplan.com with cpanel) to load my site created using codeigniter 4 (Ver: 4.1.9) only I'm experiencing some problems.
the folder structure is as follows:
\home2\bfinoshj
- .cpanel
- bin
- etc
- ...
- ...
- framework
- app
- tests
- vendor
- writable
- public_html
- assets
- index.php
- robots.txt
- vendor
- ...
first I modified the public_html/index.php
file by changing the line like this:
from: $pathsConfig = FCPATH . '../app/Config/Paths.php';
to: $pathsConfig = FCPATH . '../framework/app/Config/Paths.php';
then I set the .env file like this
CI_ENVIRONMENT = production
app.baseURL = 'https://www.example.com/'
app.forceGlobalSecureRequests = true
database.default.hostname = my_host
database.default.database = my_db
database.default.username = my_user
database.default.password = my_pass
(for privacy reasons I have omitted the data), the rest I left commented.
later I also set app/config/App.php
and app/config/Database.php
correctly.
despite this the site does not work, and the following errors are shown in the logs:
from codeigniter
CRITICAL - 2022-05-05 14:20:47 --> is_file(): open_basedir restriction in effect. File(/home2/bfinoshj/framework/vendor/autoload.php/Config/Events.php) is not within the allowed path(s): (/home2/bfinoshj/:/opt/cpanel/ea-php81/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions:/usr/local/bin/wp)
#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'is_file(): open...', '/home2/bfinoshj...', 174)
#1 /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/Autoloader/FileLocator.php(174): is_file('/home2/bfinoshj...')
#2 /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/Events/Events.php(80): CodeIgniter\Autoloader\FileLocator->search('Config/Events.p...')
#3 /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/Events/Events.php(141): CodeIgniter\Events\Events::initialize()
#4 /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/CodeIgniter.php(308): CodeIgniter\Events\Events::trigger('pre_system')
#5 /home2/bfinoshj/public_html/index.php(37): CodeIgniter\CodeIgniter->run()
#6 {main}
this from hosting log:
[05-May-2022 14:20:47 Europe/Rome] PHP Warning: is_file(): open_basedir restriction in effect. File(/home2/bfinoshj/framework/vendor/autoload.php/Helpers/url_helper.php) is not within the allowed path(s): (/home2/bfinoshj/:/opt/cpanel/ea-php81/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions:/usr/local/bin/wp) in /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/Autoloader/FileLocator.php on line 174
[05-May-2022 14:20:47 Europe/Rome] PHP Warning: is_file(): open_basedir restriction in effect. File(/home2/bfinoshj/framework/vendor/autoload.php/Config/Services.php) is not within the allowed path(s): (/home2/bfinoshj/:/opt/cpanel/ea-php81/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions:/usr/local/bin/wp) in /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/Autoloader/FileLocator.php on line 174
[05-May-2022 14:20:47 Europe/Rome] PHP Warning: is_file(): open_basedir restriction in effect. File(/home2/bfinoshj/framework/vendor/autoload.php/Config/Registrar.php) is not within the allowed path(s): (/home2/bfinoshj/:/opt/cpanel/ea-php81/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions:/usr/local/bin/wp) in /home2/bfinoshj/framework/vendor/codeigniter4/framework/system/Autoloader/FileLocator.php on line 174
I have already contacted support to ask to disable open_basedir
from the php.ini, but they replied that it is not possible for security reasons.
How can I solve? Thanks in advance