Centos中的PHP Codeigniter:include_once无法定制系统库 [英] PHP Codeigniter in Centos: include_once failing for custom system libraries

查看:287
本文介绍了Centos中的PHP Codeigniter:include_once无法定制系统库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在围绕一个Codeigniter安装(v2.0.3)构建几个应用程序。我们开始在Windows环境中开发(使用XAMPP),并将我们的alpha安装部署到一个虚拟的CentOS 5.6机器(完美工作)。随着项目的进展,我开始需要访问在Windows上几乎不可用的视频工具(ffmpeg / mencoder)。我一直在使用虚拟安装的CentOS 5.7(运行在VirtualBox 3.2.8)开发其他应用程序,所以我安装了该虚拟CentOS上的软件。我们已经在Codeigniter / system / libraries文件夹中添加了多个库,以便它们可以用于所有不同的应用程序。在我的本地虚拟CentOS上,我们的核心库将无法加载,我们收到一条错误消息,说这些类不存在。路径存在,我们可以读取它们的内容,并且include_once不会抛出一个错误...他们只是不能工作。

We are building several applications around one Codeigniter installation (v2.0.3). We began development in a Windows environment (using XAMPP), and deployed our alpha installation to a virtual CentOS 5.6 machine (which works perfectly). As the project progressed, I began to need access to video tools (ffmpeg/mencoder) that are (practically) unavailable on Windows. I have been using a virtual installation of CentOS 5.7 (running in VirtualBox 3.2.8) to develop other applications, so I installed the software on that virtual CentOS. We had added several libraries to the "Codeigniter/system/libraries" folder so that they are available to all of the different applications. On my local virtual CentOS, our core libraries will not load, we receive an error message saying the classes do not exist. The paths exist, and we can readfile their contents, and include_once does not throw an error... they just won't work.

我们跟踪了核心库,并发现我们的lib通过include_once在线886上的system / core / Loader.php中加载。经过多次调整,我们确定如果我们将include_once更改为include,则包含该文件,整个软件套件完全按预期工作(完全与其他系统一样)。

We tracked down the inclusion of the core libraries, and found that our lib was being loaded in "system/core/Loader.php" on line 886 via an "include_once". After much tweaking, we determined that if we changed that "include_once" to an "include", the file was included, and the entire software suite worked exactly as expected (exactly as it does on the other systems).

什么... ... heck?我们需要在PHP的配置中启用include_once吗?路径显然是正确的,因为包括工作。我只是没有任何愿望去改变CI的系统核心,如果它不是完全必要的。

What... the... heck? Do we need to enable "include_once" somewhere in PHP's config? The path is obviously correct, since the "include" works. I just don't have any desire to go changing the system core of CI if it's not completely necessary.

任何输入(或甚至合理的猜测)将不胜感激。干杯。

Any input (or even reasonable speculation) would be appreciated. Cheers.

推荐答案

由asker回答:

最小确定这似乎与我们的PHP版本相关。我们的旧系统工作的是PHP 5.3.3。更新的(不工作)是在PHP 5.3.4。我们将版本拉回到5.3.3,突然,CodeIgniter中的include_once魔法开始工作。他们苹果怎么样?我们现在把它称为一个PHP错误,我们将尝试重现它为所有人类(或至少任何人谁发现这个问题的利益)。

We have at least determined that this seems to be related to our version of PHP. Our old systems that worked were on PHP 5.3.3. The newer one (that does not work) is on PHP 5.3.4. We pulled back the version to 5.3.3, and suddenly the "include_once"s in CodeIgniter magically started working. How's about them apples? We're calling it a PHP bug for now, and we're going to try to reproduce it for the benefit of all mankind (or at least anyone else who finds this problem).

这篇关于Centos中的PHP Codeigniter:include_once无法定制系统库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆