I'm reworking a PHP app that was written in PHP. I want to use relative paths. The app will be running under Windows/IIS and not Linux/Apache. This is the issue I am having.
If I set an absolute path, the code works:
include_once("C:/Users/me/Documents/Projects/Projects_App/app-qas.com/site/Library/API/database.inc.php");
If I change the code to the following I can navigate to the file by clicking on it in my dev environment but when I run it I get the following error:
include_once("../../site/Library/API/database.inc.php");
Error Message: Warning: include_once(../../site/Library/API/database.inc.php): failed to open stream: No such file or directory in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 107
Warning: include_once(): Failed opening '../../site/Library/API/database.inc.php' for inclusion (include_path='.;C:\php\pear') in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 107
Fatal error: Call to undefined function db_server_connect() in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 109 HTTP/1.1 500 Internal Server Error Server: Microsoft Expression Development Server/4.0.0.0 Date: Thu, 10 Nov 2016 14:26:04 GMT Content-Length: 1959 Connection: Close
If I change it to the following I can't click on the link to get to the page BUT the app will run. It doesn't immediately throw an error (it does connect to the database) but then throws the following error:
include_once("../site/Library/API/database.inc.php");
ERROR Message Warning: include_once(../site/Library/API/database.inc.php): failed to open stream: No such file or directory in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 107
Warning: include_once(): Failed opening '../site/Library/API/database.inc.php' for inclusion (include_path='.;C:\php\pear') in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 107
Warning: include_once(../site/Library/API/database.inc.php): failed to open stream: No such file or directory in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 107
Warning: include_once(): Failed opening '../site/Library/API/database.inc.php' for inclusion (include_path='.;C:\php\pear') in C:\Users\me\Documents\Projects\Projects_App\app-qas.com\site\class\Posting.class.php on line 107
What am I missing?