2010-12-02 4 views
1

웹 서버의 다른 위치로 파일을 복사하는 데 도움이되는helper addon을 디렉토리 도우미에 사용하고 있습니다.Codeigniter의 Copy Directory Helper를 사용하여 파일 복사 및 이동

복사하려는 파일과 복사하려는 폴더가 CodeIgniter 설치 디렉토리에 있으면 완벽하게 작동합니다.

그러나 내 codeigniter 설치를 하위 디렉토리 (http://domain.com/site)에 설치 했으므로 루트 디렉토리에서 디렉토리를 이동하고 복사 할 수 있기를 원합니다.

directory_copy('./user_guide/', './test_copy/'); 

test_copy를 작성하고 user_guide의 내용을 복사합니다.

그러나

directory_copy('./user_guide/', '/test_copy/'); 

는 디렉토리에있는 각 파일에 대해

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 

... 등 원인 (대상 디렉토리에 누락 된 DOT를 (주의 사항.)) 이렇게.

나는 모든 권한을 검사했으며 정상적으로 보입니다. 스크립트가 CI 설치 외부에서 실행할 수없는 것 같습니다. 모든 도움이나 조언을

감사 감사하겠습니다

,

. (점)없이

답변

2

단순히 서버 루트 /를 참조하고, 위해 루트 사용자 권한을 필요로
새 폴더를 추가합니다.
아파치를 실행하는 사용자에게이 경우 충분한 권한이 없습니다.

액세스 권한이 있고 쓰기 권한이있는 다른 폴더로 복사하기 만하면됩니다. 아래 줄을 추가

+0

안녕하세요, 난 당신의 제안을 시도했지만도 작동하지 않는 다른 서브 디렉토리로 이동했다. 그래서 http://domain.com/folder에서 http://domain.com/folder2로 복사 작업을하지 않습니다 ... 분명히 내가 할 수있는 충분한 권한이 ... 특히 복사 및 withnin 파일을 성공적으로 이동할 수있게되었습니다 내 CI 설치 "/ 폴더"??? – Tim

+0

@Tim - 대상 폴더에 절대 경로를 사용하십시오. 코드 표시처럼 '/'를 가리키는 상대 경로를 사용하고 있습니다. 이중 체크? 그렇지 않으면 CI 복사 기능이 무엇인지 이해하십시오. – ajreal

+0

감사합니다. 당신의 제안은 나를 올바른 길로 인도했습니다. $ _SERVER를 사용하여 [ 'DOCUMENT_ROOT'] 마침내 나에게 줬어 !!! 건배하고 좋은 밤 보내! – Tim

0

응용 프로그램/설정/config.php를

시도 :

$config['sess_save_path'] = NULL; 

$config['sess_save_path'] = sys_get_temp_dir();