简体   繁体   English

包括仅在开发服务器上工作

[英]Includes only working on dev server

I have the following code in a php/html file:我在 php/html 文件中有以下代码:

<?php
    include('sample.php');
    include_once('foo.php');
    include('bar.php');
?>

On my dev server (php's built-in server), everything is working fine, on the production server (apache2) though I get a blank page when accessing the file.在我的开发服务器(php 的内置服务器)上,一切正常,在生产服务器 (apache2) 上,尽管访问文件时出现空白页面。 The only way to get to the actual page is by removing all 3 includes, removing a single one or two of them does not resolve the problem.进入实际页面的唯一方法是删除所有 3 个包含,删除其中的一个或两个并不能解决问题。 In the included files I do include files, which might get loaded more than once with include_once.在包含的文件中,我确实包含文件,这些文件可能会通过 include_once 多次加载。 Apart from that I have no glue why there is an error since everything is working on my dev server and some of the included files work well in other parts of the app.除此之外,我不知道为什么会出现错误,因为一切都在我的开发服务器上运行,并且一些包含的文件在应用程序的其他部分运行良好。

It is probable that the configuration of include_path on your dev server contains .您的开发服务器上的include_path配置可能包含. , which means: if file is included with relative path, try to find it in the current directory . ,这意味着:如果文件包含在相对路径中,则尝试在当前目录中找到它 This setting is probably not present on the prod server (see for yourself with phpinfo() ).此设置可能不存在于 prod 服务器上(使用phpinfo()亲自查看)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 包括无法正常工作的easyphpdev服务器 - includes not working easyphpdev server SSI包括不在服务器上工作但在本地工作 - SSI includes not working on server but working locally 可在本地开发机上精简工作,但不能在远程服务器上 - Slim working on local dev machine but not remote server PHP创建映像文件,但仅适用于本地开发人员,而不适用于远程服务器 - PHP creates image file but only works on local dev, not at the remote server $(…).live不是函数-仅在本地服务器上出现YII问题-版本1.1.17 -dev - $(…).live is not a function - YII issue on Local server only - version 1.1.17 -dev MySQL 服务器已在 Symfony 2.8 中消失(仅在 stag 中,不在 dev 中) - MySQL server has gone away in Symfony 2.8 (only in stag, not in dev) 如何让webpack-dev-server与现有应用程序一起使用? - How to get webpack-dev-server working with an existing app? codeigniter file_get_content或curl在我们的开发服务器中不起作用 - codeigniter file_get_content or curl is not working in our dev server 通过sFTP在远程开发服务器上处理PHP项目 - Working on PHP projects on a remote dev server via sFTP ftp_nlist返回布尔值true-在服务器上不起作用,在dev上 - ftp_nlist returning boolean true - not working on server, is on dev
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM