Using Copy Directory Helper in Codeigniter to copy and move files
I am using this copy directory helper addon for the directory helper to help me copy files to different places on my web server.
It works perfectly if the files you are copying from and the folder you are copying to are located within the CodeIgniter install directory.
I however have my codeigniter installation in a subdirectory (http://domain.com/site) and would like to be able to move and copy directories in the root directory.
directory_copy('./user_guide/', './test_copy/');
Creates test_copy and copies the contents of user_guide to it.
However doing this (NOTICE the missing DOT( . ) in the destination directory)
directory_copy('./user_guide/', '/test_copy/');
Causes
A PHP Error was encountered
Severity: Warning
Message: mkdir() [function.mkdir]: Permission denied
Filename: helpers/directory_helper.php
Line Number: 91
A PHP Error was encountered
Severity: Warning
Message: mkdir() [function.mkdir]: No such file or directory
Filename: helpers/directory_helper.php
Line Number: 91
A PHP Error was encountered
Severity: Warning
Message: copy(/test_copy/helpers/cookie_helper.html) [function.copy]: failed to open stream: No such file or directory
Filename: helpers/directory_helper.php
Line Number: 99
A PHP Error was encountered
Severity: Warning
Message: copy(/test_copy/helpers/string_helper.html) [function.copy]: failed to open stream: No such file or directory
Filename: helpers/directory_helper.php
Line Number: 99
...etc for each file in the directory.
I have checked all permissions a开发者_如何学Gond they seem fine. It seems the script can’t execute outside of the CI installation.
All help or advice would be appreciated
Thanks,
Tim
Without the .
(dot) is simply refer to server root /
,
which require root user permission for adding new folder.
User running apache does not have enough permission in this case.
Simply copy to another folder that apache user able to access and has write permission.
application/config/config.php
Try adding the below line:
$config['sess_save_path'] = NULL;
$config['sess_save_path'] = sys_get_temp_dir();
精彩评论