如何在服务器上托管带有CodeIgniter的网站?

时间:2015-11-13 08:50:16

标签: codeigniter hosting web-hosting codeigniter-3

当我在localhost中测试我的网站时,它可以正常工作 但是,当我在服务器上托管它时,当我点击指向另一个页面的链接时,它有时会出错。如果我然后刷新页面错误就消失了。

这是给出的错误:

A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session56b5fa78806f1c156117b29a0740a0758f622d7d) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessiona3989ff9d3733b42f94dcc29bde8fcdaac8bcdd6) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session02fd76ea7ba9c61f8121a51816371298b37caffc) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessionb918fe8d8e5e68e283cb237f09489808bd770bf8) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session95ad2c5e9e679c17864def621d85a11a3c02333a) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session8bf9a821db45a792cde9a215d6bd81a1fd293142) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session6af732ebfdc9595eb18488d6cbeb593993d3ebb9) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessione100361271a683035cfce62bbed319731a18e384) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessione3c47aed6a4afc9f617959e9aff657ed40c81cd7) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session868cfe7d9085879b8b8d778fd3e1274eef8bd4fa) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session293c6e415fe74c1ff4880f7e97d5a5a46e763544) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session060b5943e6fb48e8315024bbf3c6e03155d4ce70) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session011ebd239e0e88b365ec2dd0b86bd1050b8377be) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessionc9098c7bb0ba0dc436d1bbbcd5939fd4a379e738) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session7b5fd7526aea207013790bd74e26ab43633d1594) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session02fa433192e4890acf50603478c95836ec7f0893) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session5857b16bce1f4d673a503e35185dde18859ec964) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessiona07c2aa936dc838d06be2556bb1fa0e0436c2b35) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessionf24303a61f7a4880b1c8a825bc215beb6af3b82b) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessionef71fce1928aa6f4df36f1993aa072f1f0d228bb) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session2bbba3d6e4471a259431226a74c36f8678fb7510) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session28c2208351dedf2d4fb609395d9745d54c5edbdb) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session699bcf86dc0a4eb6447bed8405f2be724b0bfeba) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_sessiona6a071939bf256531d583c4c72179e4f9a20df4b) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once
A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session40467c8499001305ce4650a37b362855711d7898) [function.unlink]: Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 354

Backtrace:

File: /home/wwwmyburgerlabco/public_html/mbl/application/controllers/mbl-admin/Site_admin.php
Line: 6
Function: __construct

File: /home/wwwmyburgerlabco/public_html/mbl/index.php
Line: 292
Function: require_once

1 个答案:

答案 0 :(得分:1)

通常在共享主机上无法访问tmp安装的php文件夹,因此CodeIgniter无法记录会话。
您可以将会话保存路径更改为相对站点路径以解决此问题。

转到config.php并更改

$config['sess_save_path'] = NULL;

$config['sess_save_path'] = BASEPATH . 'application/cache/';

确保缓存文件夹具有777的权限。