简体   繁体   中英

Included PHP class doesn't know config.php

this one left me quite confused, so maybe someone here can help.

I developed a website using Netbeans and XAMPP on my local system, where it runs perfectly. Now I tried to move this to the webspace to let others take a look. Shouldn't be a problem since I put the database connection info and all paths in a config.php which would only need a few changes, or so I thought.

The index.php only includes the config, then includes a helper class and creates the object that should do all the work.

require_once('config.php'); 
require_once(LIB_PATH.'system/RequestController.class.php');
new RequestController();

Works well locally, but the page stays white on the webspace. So far I only figured out, that the RequestController class does not know anything about the config.php. So when the RequestController.class.php tries to include something else ...

require_once(LIB_PATH.'system/SessionController.class.php');

... everything falls apart since it doesn't know the constant LIB_PATH.

Any idea what I can do short of adding the config include to every single class? Why does it work locally but not on the webspace, even though nothing else has changed?

I'm thankful for any input!

我认为问题出在您的命名上,因为在localhost上您可以正常工作,检查每个类名,等等。在Linux服务器上区分大小写。

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