Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

path to file outside root directory


eeyipes

Recommended Posts

A system path, I think?

 

Can you tell I'm a newbie?

 

I'm trying to add a require for a php file outside my root directory , and I can't seem to get the path right. Whatever I put it keeps looking for it inside the directory - how do I get it to look outside?

 

I have a file in my catalog and I'm trying to add a require to a file outside my "www" that I want to refer to if I can.

 

Just a generic example might head me on the right path.

 

Thanks!

Link to comment
Share on other sites

Can you just copy the file and put it in your osc directory?

If not:

 

require('http://yourwebsite.xxx/path/to/the/file.php');

"Aliiiiive, it's alive, it's ALIIIIIIIIIIIIIVE!!!"

Link to comment
Share on other sites

I need to call on the file from both the admin and catalog side.

 

If I put the file in the same directory on the catalog side and call on it as

 

require('myfile.php');

 

it works perfectly.

 

But if I try to call on it like this

 

 

require('http://mysite/path/to/myfile.php');

 

I get this error

 

 

Warning: main(http://mysite.biz/path/to/myfile.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

 

I've tried it with the "www" in there too ... what am I doing wrong?

Link to comment
Share on other sites

I answered the question like a newbie. Require and include statements are FS paths not virtual paths. Please ignore my previous post. Sorry. Going to bed.

"Aliiiiive, it's alive, it's ALIIIIIIIIIIIIIVE!!!"

Link to comment
Share on other sites

Here's a couple wiki docs to study

 

http://wiki.oscommerce.com/WarnSecurity

http://wiki.oscommerce.com/helpHowtoRemoveSecurityWarnings

 

The "security" part of the title is a little misleading. They both have good info on using relative linking.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Link to comment
Share on other sites

If you put the file in catalog/includes

 

Then it would be like so from catalog dir

 

require('includes/myfile.php')

 

And like so from admin.

 

require('../catalog/includes/myfile.php')

 

 

 

If you put the file in admin/catalog/includes

 

Then it would be like so from catalog dir

 

require('admin/includes/myfile.php')

 

And like so from admin.

 

require('includes/myfile.php')

 

 

Usually you dont use 'http://' to require files on the local file system.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...