Page 1 of 1

include statement

PostPosted: 27. January 2016 07:56
by Night
Slowly getting things to work but ran into a problem not sure how to resolve. Getting this error when trying to go to a link:

Warning: require(includes/application_top.php): failed to open stream: No such file or directory in C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\index.php on line 26

Fatal error: require(): Failed opening required 'includes/application_top.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\index.php on line 26

This is part of the code calling the include:
/**
* Load common library stuff
*/
require('includes/application_top.php'); THIS IS LINE 26

$language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
$directory_array = $template->get_template_part($code_page_directory, '/^header_php/');
foreach ($directory_array as $value) {
/*

I changed it to this in hopes it would fix the problem:
*/
/**
* Load common library stuff
*/
require('includes/thedreamweaver/zen-cart-v1.5.1-full-fileset-09182012/application_top.php');

$language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
$directory_array = $template->get_template_part($code_page_directory, '/^header_php/');
foreach ($directory_array as $value) {
/*
This is where the file is located C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\includes\application_top.php
any ideas?

Re: include statement

PostPosted: 27. January 2016 12:50
by Nobbie
Night wrote:This is where the file is located C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\includes\application_top.php
any ideas?


Undo your changes, then edit php.ini, look for "include_path" and extend the value by C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012. Finally restart Apache.

Anyway, your changes are nonsense, they point to a non-existing path:

Night wrote:require('includes/thedreamweaver/zen-cart-v1.5.1-full-fileset-09182012/application_top.php');


You could have changed it to that (instead of editing php.ini):

Code: Select all
require('C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\includes\application_top.php');


but i prefer not to change the source, instead change php.ini

Re: include statement

PostPosted: 27. January 2016 13:14
by Altrea

Re: include statement

PostPosted: 27. January 2016 13:24
by Nobbie
I wonder why it fails to include, as '.' is already part of include_path (which basically yields to the same location as __DIR__)?! Maybe it should be './' instead?

Re: include statement

PostPosted: 27. January 2016 13:41
by Altrea
Nobbie wrote:I wonder why it fails to include, as '.' is already part of include_path (which basically yields to the same location as __DIR__)?! Maybe it should be './' instead?

The only difference between already being . in the include_path and using __DIR__ is that __DIR__ transforms this reference to an absolute path.
The include path works as expected as long as there is no document with the same relative path present in the other include path folders like PEAR.

But this problem here is not solvable because in my test environment it is successfully working with the given information without changing anything to the require code.
So either the information here is wrong or zen cart is doing something magic here to produce that problem.

Re: include statement

PostPosted: 27. January 2016 19:07
by Nobbie
Altrea wrote:The only difference between already being . in the include_path and using __DIR__ is that __DIR__ transforms this reference to an absolute path.


I know, but according to the given input that *should* be the current directory ".".

Altrea wrote:But this problem here is not solvable because in my test environment it is successfully working with the given information without changing anything to the require code.
So either the information here is wrong or zen cart is doing something magic here to produce that problem.


Or the description is wrong...

Re: include statement

PostPosted: 29. January 2016 05:35
by Night
Nobbie wrote:
Night wrote:This is where the file is located C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\includes\application_top.php
any ideas?


Undo your changes, then edit php.ini, look for "include_path" and extend the value by C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012. Finally restart Apache.

Anyway, your changes are nonsense, they point to a non-existing path:

Night wrote:require('includes/thedreamweaver/zen-cart-v1.5.1-full-fileset-09182012/application_top.php');


You could have changed it to that (instead of editing php.ini):

Code: Select all
That is an existing path but I guess it won't work that way. Changed the php.ini file and that did take care of the problem. Thanks. As I keep plugging along, I will post when and if I run into another problem I can't fix.
require('C:\xampp\htdocs\thedreamweaver\zen-cart-v1.5.1-full-fileset-09182012\includes\application_top.php');


but i prefer not to change the source, instead change php.ini

Re: include statement

PostPosted: 31. January 2016 02:13
by Night
Dumping my host, say my SQL server is gone! what ever that means!