douchou8935 2019-05-12 18:08
浏览 106

尝试在cPanel上运行localhost网站时出错

I have been trying to switch my web app from localhost to a school server but it's telling me it cannot find the path:

Warning: require_once(/util/tags.php): failed to open stream: No such file or directory in /home/xiaoant/public_html/database_pizza/pizza/util/main.php on line 17

Fatal error: require_once(): Failed opening required '/util/tags.php' (include_path='///') in /home/xiaoant/public_html/database_pizza/pizza/util/main.php on line 17

    <?php
    // Start session to store user and cart data
    session_start();

    // Get the document root
    $doc_root = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT', FILTER_SANITIZE_STRING);

    // Get the application path
    $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING);
    $dirs = explode('/', $uri);
    $app_path = '/' . $dirs[1] . '/' . $dirs[2] . '/';

    // Set the include path
    set_include_path($doc_root . $app_path);

    // Get common code
    require_once('/util/tags.php');
    require_once('/model/database.php');

    // Define some common functions
    function display_db_error($error_message) {
        global $app_path;
        include 'errors/db_error.php';
        exit;
    }

    function display_error($error_message) {
        global $app_path;
        include 'errors/error.php';
        exit;
    }
    ?>
  • 写回答

1条回答 默认 最新

  • duanlan7239 2019-05-13 06:57
    关注

    If you're using window and hosted it on a linux server Please check you path if it contain upper case letters directory names in linux is case sensitive unlike windows Also you could list all the files in directory to check

    '''$files1 = scandir($dir); print_r($files1); ''' And see if it there

    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧