Severity: Warning
Message: mkdir(): open_basedir restriction in effect. File() is not within the allowed path(s): (/home/thelazyppl/:/home/thelazyppl:/tmp:/usr/local/lib/php/)
Filename: drivers/Session_files_drivers.php
The site's root folder is a wordpress website, so i've create a subdomain for the Codeigniter site named "Bazaar" in the root folder. I've already setup the base_url in the config.php and wordpress htaccess to allow the folder "Bazaar" but still nothing is working.
My host do not allow modifications for the php.ini file to disable open_basedir, is there another way to allow it or did i do something wrong in the process?
Your CodeIgniter installation is trying to save its session files to somewhere that is unwritable. As you're on shared hosting, I would recommend storing your session data in a database.
Based on the filename causing the error, it looks like you're on CodeIgniter 3. There is some info in the user guide on how to configure it correctly.
To keep using the files driver, you will need to change the contents of the $config['sess_save_path']
variable to point it to something like /tmp
or /home/thelazyppl/tmp
(after you created the tmp
folder in your FTP outside your www
or public_html
directory).
The better option would be to use the database driver, for which the details are just below that.
If you were having these issues on CodeIgniter 2, you would need definitely need to enable the database. To do this you would change the $config['sess_use_database']
option to TRUE
and then run the SQL shown in the CodeIgniter 2 user guide.
After reading the official documentation
In config.php
You need to modify
FROM
$config['sess_driver'] = 'files';
$config['sess_save_path'] = NULL;
TO
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';
as well as you need to create the table by the name ci_sessions
in case if it doesn't exist.
In order to use the ‘database’ session driver, you must also create this table that we already mentioned and then set it as your $config['sess_save_path']
value. For example, if you would like to use ‘ci_sessions’ as your table name, you would do this:
Note
If you’ve upgraded from a previous version of CodeIgniter and you don’t have ‘sess_save_path’ configured, then the Session library will look for the old ‘sess_table_name’ setting and use it instead. Please don’t rely on this behavior as it will get removed in the future.
And then, of course, create the database table …
For MySQL:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);
For PostgreSQL:
CREATE TABLE "ci_sessions" (
"id" varchar(128) NOT NULL,
"ip_address" varchar(45) NOT NULL,
"timestamp" bigint DEFAULT 0 NOT NULL,
"data" text DEFAULT '' NOT NULL
);
CREATE INDEX "ci_sessions_timestamp" ON "ci_sessions" ("timestamp");
You will also need to add a PRIMARY KEY depending on your ‘sess_match_ip’ setting. The examples below work both on MySQL and PostgreSQL:
// When sess_match_ip = TRUE
ALTER TABLE ci_sessions ADD PRIMARY KEY (id, ip_address);
// When sess_match_ip = FALSE
ALTER TABLE ci_sessions ADD PRIMARY KEY (id);
// To drop a previously created primary key (use when changing the setting)
ALTER TABLE ci_sessions DROP PRIMARY KEY;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With