简体   繁体   中英

Includes only working on dev server

I have the following code in a php/html file:

<?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. 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. In the included files I do include files, which might get loaded more than once with 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 . , 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() ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM