I am following this tutorial:
however when I access to
http://localhost/index.php/user_authentication/
I got this get warning and cannot get the code running:
Warning: include(C:\xampp\htdocs\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\xampp\htdocs\system\core\Exceptions.php on line 269
Warning: include(): Failed opening 'C:\xampp\htdocs\application\views\errors\html\error_php.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\system\core\Exceptions.php on line 269
Warning: include(C:\xampp\htdocs\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\xampp\htdocs\system\core\Exceptions.php on line 269
Warning: include(): Failed opening 'C:\xampp\htdocs\application\views\errors\html\error_php.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\system\core\Exceptions.php on line 269
When I remove the $this->load->library('session');
the warnings are gone so I am pretty sure I got the error in loading the session library.
I have read that the issue is fixed by changing $config['sess_save_path'] = sys_get_temp_dir();
but i still get the warning.
I even tried adding this code to my controller:
mkdir("/thisisthedirectory", 0700);
then changed my $config['sess_save_path'] = "/thisisthedirectory"; but it doesn't work
nor $config['sess_save_path'] = "C:\thisisthedirectory";
Can anybody tell me how to fix this problem?
Make sure you have set your session save path something like
$config['sess_save_path'] = APPPATH . 'cache/';
Folder Permissions 0700
Config.php
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = APPPATH . 'cache/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;
Note: Make sure you have followed the Codeigniter Style Guide For File Naming and Class Naming
While you are working with .env file and your sessionSavePath will not absolute it will show error like this
set your sessionSavePath as absolute path as below
app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'
app.sessionCookieName = 'ci_session'
app.sessionSavePath = '/home/user/public_html/project/public/NULL'
app.sessionMatchIP = false
app.sessionTimeToUpdate = 300
app.sessionRegenerateDestroy = false
It will fix your problem
Thank you
you may try to load parent constructor like this
parent::__construct();
$this->load->library('session');
I hope it solves the problem
Related
In Codeigniter 4 URL with www. not shown www in base URL().
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://". $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
This source code is also not working.
How can I solve this?
base_url([$uri = ''[, $protocol = null]])
Returns your site base URL, as specified in your config file. Example:
<?php
echo base_url();
Define your base URL in your .env file at the root of your project. Example:
app.baseURL = 'http://www.your-domain.com'
when you first setup a codeigniter project you will see a env file in your root, copy that file and rename it to .env env with a dot.
Then in that folder look at line 23 I think or just look for #app.baseURL = 'http://localhost:8080/' Then Remove the hash(#) and just add www. in front of localhost like this app.baseURL = 'http://www.yourdomain.com/'
Also Remember to change your $baseURL in app\Config\App.php to your domain.
FYI:
What is a .env file?
A .env file or dotenv file is a simple text configuration file for controlling your Applications environment constants.
I recommend you look at the codeignter official docs aswell
I am getting error not regularly but after time intervals:
Message:
unlink(/tmp/ci_session0189a7f1c86eb18fb70afcfedc2d5040e9c23146):
Operation not permitted
In config I tried:
$config['sess_save_path'] = sys_get_temp_dir();
Also tried:-
In config:
$config['sess_save_path'] = BASE_URL.'application/temp/';
also changed the permission of it (755 & 777)
Though not getting resolved..
Use FCPATH or APPPATH
Location application > temp
$config['sess_save_path'] = APPPATH . 'temp/';
OR
$config['sess_save_path'] = FCPATH . 'application/temp/';
Folder permission for sessions 0700
EXT: The PHP file extension
FCPATH: Path to the front controller (this file) (root of CI)
SELF: The name of THIS file (index.php)
BASEPATH: Path to the system folder
APPPATH: The path to the "application" folder
I need to know if any special configuration in the ide PhpStorm to use CodeIgniter . I'm having problems permission to access session variables and writing temporary files . The server is XAMPP local for IOS
Error from comment
A PHP Error was encountered Severity: Warning Message: Unknown: Failed
to write session data (files). Please verify that the current setting
of session.save_path is correct (/Applications/temp/) Filename:
Unknown Line Number: 0 Backtrace: A PHP Error was encountered
Severity: Warning Message: Unknown:
open(/Applications/temp//sess_acelvldc0c60ti1pj13fmil6t6, O_RDWR)
failed: Permission denied (13) Filename: Unknown Line Number: 0
Backtrace
When you use session files on codeigniter 3
Where ever you save your file example:
application
application > temp
Then on your config.php
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = APPPATH . 'temp/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
Make sure the sess_save_path has /at end.
Also make sure you have set temp folder permissions to chmod 0700 You need set permission for your var directory
When open codeigniter project localhost they work properly and open in server then error of invalid path
A PHP Error was encountered
Severity: Warning
Message: mkdir(): Invalid path
Filename: drivers/Session_files_driver.php
Line Number: 117
Backtrace:
File: /Library/Server/Web/Data/Sites/garden_worx/index.php Line: 292
Function: require_once
Error 2
An uncaught Exception was encountered
Type: Exception
Message: Session: Configured save path '' is not a directory, doesn't
exist or cannot be created.
Filename:
/Library/Server/Web/Data/Sites/garden_worx/system/libraries/Session/drivers/Session_files_driver.php
Line Number: 119
Backtrace:
File: /Library/Server/Web/Data/Sites/garden_worx/index.php Line: 292
Function: require_once
Error 3
A PHP Error was encountered
Severity: Warning
Message: fopen(6d898f163e36616cef220426dad109225a66f74a): failed to
open stream: Permission denied
Filename: drivers/Session_files_driver.php
Line Number: 156
Backtrace:
This will be really helpful to you, it was save my day too :)
in your config.php
$config['sess_save_path'] = sys_get_temp_dir();
Similar Question
session error in codeigniter?
In codeigniter 3 versions you can use files or database if files, make sure you have created folder where you would like your session path set and chmod 700
I use cache folder to store files sessions
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 1440;
$config['sess_save_path'] = FCPATH . 'application/cache/sessions/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;
Auto load session in application > config > autoload
$autoload['libraries'] = array('session');
Note: Make sure all file names and class names of controllers,
models, libraries have first letter upper case example filename Welcome.php and class Welcome extends CI_Controller {}.
Codeigniter doc's 2 and 3 http://www.codeigniter.com/docs
Codeigniter 3 session http://www.codeigniter.com/user_guide/libraries/sessions.html
Codeigniter 2 session: http://www.codeigniter.com/userguide2/libraries/sessions.html
You also may need to have a encryption_key on config.php
$config['encryption_key'] = 'pXeQY2733rR560MrwJy40OL4WaSGmr5A';
http://randomkeygen.com/
Simply change this in your, application -> config -> config.php
$config['sess_save_path'] = NULL;
To
$config['sess_save_path'] = FCPATH.'ci_sessions';
It will create a Directory in your Root.
Hopefully your problem will solve ...
Thanks
This worked for me
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = sys_get_temp_dir();
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
you can also put
output_buffering = On
in your php.ini file on the root
Change 'NULL' to either '/tmp' or your servers temp folder path
The line should now read:
$config['sess_save_path'] = '/tmp';
adding 'session' in autoload.php file solved my problem
$autoload['libraries'] = array('form_validation','session');
This work for me
$config['sess_save_path'] = sys_get_temp_dir();
I'm trying to make a script in photoshop that will modify some layers and than export them as a PNG image. I've copied the following code from another place:
function SavePNG(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = false;
pngOpts.transparency = true;
pngOpts.interlaced = true;
pngOpts.quality = 100;
activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);
}
The function export the active document of photoshop to the file specified by the saveFile parameter.
It's working fine with simple paths like "C:\images\result.png" but when trying with different paths like "~/Desktop/" or paths with some special characters the file isn't exported, and a "destination folder does not exist" error message appears.
Any idea how can I solve it?
Well, I'm not sure why this is occur but you could try the following modification:
function SavePNG(saveFile){
var tmpFile = "./tmp.png";
tmpFile = new File(tmpFile);
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = false;
pngOpts.transparency = true;
pngOpts.interlaced = true;
pngOpts.quality = 100;
activeDocument.exportDocument(tmpFile,ExportType.SAVEFORWEB,pngOpts);
tmpFile.rename (saveFile);
tmpFile.changePath(saveFile);
}
it'll export the file into a temporary file and then rename & move it to the requested path, should solve the path problem.
exportDocument expects a full file name, not a folder path.
This works:
activeDocument.exportDocument(new File("~/foo/foo.png"), ExportType.SAVEFORWEB, pngOpts);
This doesn't work and gives the 'destination folder does not exist' error message:
activeDocument.exportDocument(new File("~/foo/"), ExportType.SAVEFORWEB, pngOpts);
For people having this error and not using photoshop-script.
The error might be unbound to the destination folder, but occurs because the folder, which was used for the export step, is deleted. So either
recreate the folder, which was used during recording, or
recreate the export step