Jump to content

fatkatie

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by fatkatie

  1. Thanks guys. Let me restate this and also add a few things. First full paths are used because this site is broken. It's a 5 year build of a half dozen programmers in multiple countries. It's a mess. Full paths are being used for file security as we go thru the system. Full path are constructed with defs defined inside the global_def.php file, which is the first file always listed. It is used to build these absolute paths. Here are the files involved. I guess the above was a bit convoluted. xampp/htdocs/mninfo/index.php xampp/htdocs/mninfo/oldstuff.php xampp/htdocs/mninfo/includes/thisfile.php File index.php: require 'global_defs.php'; require DDEF_INCLUDES . 'thisfile.php'; // DDEF_INCLUDES == '/xampp/htdocs/mninfo/includes/' File thisfile.php: require '../oldstuff.php'; That require should work according to my understanding of the include rules. Why doesn't it. There are reasons that thisfile.php require cannot use global definitions. But besides that, why doesn't it work? This error log doesn't make sense to me. It seems to be saying its using the defined include path. PHP docs say relative paths ignore the predefined includes: [Wed Feb 01 21:57:04.761838 2017] [:error] [pid 5580:tid 1652] [client 127.0.0.1:55060] PHP Fatal error: require_once(): Failed opening required '../oldstuff.php' (include_path='C:\\xampp\\php\\PEAR') in C:\\xampp\\htdocs\\mninfo\\includes\\thisfile.php on line 12 Thanks again for helping.
  2. Greetings all. New user. So glad to participate in a group with no badges (I don't need no stink'n ...) I'm building a page and have a requisite number of 'requires' at the beginning of the php code. The paths to the required files are all absolute except for the base global def file. For example. My home development environment is a standard xampp port with php 5.6.24. The apache2 document root is C:\xampp\htdocs. The website files are under this, in a "distribution" directory, so the path to the main index file would be: http://localhost/mninfo/index.php In index.php the required files are defined with a full path, as in require '/xampp/htdocs/mninfo/js/common.js'. Inside index.php, one of the required files itself has a required file. That will be fixed later. But it generated this question. Here is the flow/structure /xampp/htdocs/mninfo/index.php require '/xampp/htdocs/mninfo/includes/thisfile.php ... and inside thisfile.php /xampp/htdocs/mninfo/includes/thifile.php require '../oldstuff.php' The require fails. The error says: [Wed Feb 01 21:57:04.761838 2017] [:error] [pid 5580:tid 1652] [client 127.0.0.1:55060] PHP Fatal error: require_once(): Failed opening required '../oldstuff.php' (include_path='C:\\xampp\\php\\PEAR') in C:\\xampp\\htdocs\\mninfo\\includes\\thisfile.php on line 12 I don't understand why. php says any relative file path will use current directory as the base reference. dotdot should point to the directory above 'includes' If the relative path is removed (file name only). It works. If the complete path is included, it works. Thanks for any help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.