【发布时间】:2015-06-12 14:38:56
【问题描述】:
我有一个使用 PHP 5.4 设置的 Openshift 帐户。
我有两个文件位于同一目录中:
index.php
LoginWebInterface.php
我的 index.php 文件中有:
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
...
include 'LoginWebInterface.php';
访问 index.php 时出现错误提示:
警告:包含(LoginWebInterface.php):无法打开流:第 55 行的 /var/lib/openshift/55181c105973ca076e000074/app-root/runtime/repo/index.php 中没有此类文件或目录警告:包含( ):无法打开“LoginWebInterface.php”以包含(include_path='.:/var/lib/openshift/55181c105973ca076e000074/app-root/runtime/repo/lib:/var/lib/openshift/55181c105973ca076e000074/app-root/runtime /repo/libs:/var/lib/openshift/55181c105973ca076e000074/app-root/runtime/repo/libraries:/var/lib/openshift/55181c105973ca076e000074/app-root/runtime/repo/src:/var/lib/openshift/ 55181c105973ca076e000074/app-root/runtime/repo/vendor:/var/lib/openshift/55181c105973ca076e000074/app-root/runtime/repo/vendors:/var/lib/openshift/55181c105973ca076e000074/php/phplib/pear/pearphp/: /usr/share/pear') 在 /var/lib/openshift/55181c105973ca076e000074/app-root/runtime/repo/index.php 第 55 行
我已阅读以下网站上的文档/数据并尝试了他们的解决方案,但无济于事:
- https://developers.openshift.com/en/php-repository-layout.html
- https://developers.openshift.com/en/managing-environment-variables.html
- [抱歉,没有足够的代表来制作其余链接]
- forums.openshift.com/cant-include-any-files-in-php-deployment
- stackoverflow.com/questions/23299277/php-require-once-fatal-error-in-openshift-maybe-a-filepath-issue-but-im-stump
- forums.openshift.com/cant-include-any-files-in-php-deployment
- forums.openshift.com/problems-with-path-of-openshiftinc-cakephp
- stackoverflow.com/questions/21075003/openshift-php-file-not-found-same-syntax-in-localhost
我尝试过的解决方案包括:
- 将 anotherCode.php 移动到与 index.php 位于同一目录的名为 lib 的文件夹中,并使用“lib/LoginWebInterface.php”
- 使用 $_ENV['OPENSHIFT_HOMEDIR'] 。 '/app-root/runtime/repo/LoginWebInterface.php'
- 使用 $_ENV['OPENSHIFT_REPO_DIR'] 。 'LoginWebInterface.php'
- 使用多层嵌套目录(__FILE__)。 'LoginWebInterface.php'
- 上述一项或多项的许多变体
【问题讨论】:
标签: php openshift php-include openshift-php-cartidges