Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

File inclusion errors when installing


gerrysweeney

Recommended Posts

I have just tried to test osCommerce and followed the instrctions for installation. After copying the catalog foler to my htdocs folder, then run http://localhost/catalog/install/ I get the following errors: -

 

Warning: main(includes/functions/general.php): failed to open stream: No such file or directory in D:\Program Files\Hornbill\Core Services\SwHttpServer\htdocs\catalog\install\includes\application.php on line 22

 

Fatal error: main(): Failed opening required 'includes/functions/general.php' (include_path='d:\Program Files\Hornbill\Supportworks Server\html\_phpinclude;d:\Program Files\Hornbill\Core Services\SwHttpServer\phpincludes') in D:\Program Files\Hornbill\Core Services\SwHttpServer\htdocs\catalog\install\includes\application.php on line 22

 

When I take a look at the application.php file on line 22 I see: -

 

require('includes/functions/general.php');

 

Whict to me seems wrong. The application.php file is in the includes folder so, the line should surely be: -

 

require('functions/general.php');

 

If I change this and a couple of others the installation procedure then works as expected. If course, the main program does not for the same reasons.

 

Can someone tell me what I am missing? Is there a PHP config option that tells PHP to assume relative path includes include the name of the current folder or something?

 

Any help would be appreciated.

 

Gerry

Link to comment
Share on other sites

I am having the same problem as well. If any answer is found I would like to know as well.

 

Thanks :blink:

 

I never had that problem and am running it in Windows with MySQL5 and PHP5. You may just have to make the changes to each file to get it to work. Who really knows what it could be?

Kory

Link to comment
Share on other sites

I never had that problem and am running it in Windows with MySQL5 and PHP5. You may just have to make the changes to each file to get it to work. Who really knows what it could be?

Kory

 

Surely that can not be right. The PHP code makes a fundimental assumption about paths which to me seems wrong. Does any of the developers not know whats goung on?

 

I have made the changes to the installation script, that was easy. However, it is not so easy to change the main app as the include paths are made up from variables.

 

Consider the following folder structure:

 

/ ---

|

---- forum

|

------ includes

 

 

If you have a file called index.php in the 'forum' folder, and the index.php file wishes to include a file called stuff.php that is in the includes folder, you would write: -

 

include('includes/stuff.php')

 

because this is a relative path, and relative means, relative to the folder where the current file is.

 

Now what I can not understand is, osCommerce writes the following: -

 

include('forum/includes/stuff.php')

 

Which is basically wrong, and when I install it, I get the error I would expect.

 

Now I do not for one minute think that osCommerce is broken, many people seem to be using it, so how is this meant to work. Someone must have a logical answer to this?

Link to comment
Share on other sites

OK, I have found the answer. The fact is, I am afraid to report that the osCommerce code is wrong and makes an incorrect assumtion with relative paths. However, you can work around this by ensuring your include_path directive in the PHP.INI file contains a path of '.'. It seems that the '.' tells PHP to assume that the first folder in a specified path is the name current folder, odd behaviour. This seems to be set in the default PHP installation which is why most people do not see the problem. This is definitly an oddity with PHP, and sadly the osCommerce code seems to be taking advantage of that.

 

So, if you want to fix this, simply modify your PHP.INI file and add the '.' path. My one looks like this now: -

 

include_path = "c:/php/includes;."

 

However, developers please note, osCommerce should really be fixed so this is not needed!!

 

Gerry

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...