Forums / Installing on a Linux/Unix Server / can't move download dir. out of the web root.

can't move download dir. out of the web root.

Locked

Started by quixotic on 1 Aug 2007, 6:43 PM · Views: 5,113

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
1 Aug 2007, 6:43 PM
#1
quixotic avatar

quixotic

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

can't move download dir. out of the web root.

I can't seem to move the download directory above the web root. Moving the download directory and changing the config.php files to match (using the full path) works when it's in the web space. For example these all work:

/var/www/vhosts/host.com/httpdocs/someplace/store/download/
/var/www/vhosts/host.com/httpdocs/someplace/download/
/var/www/vhosts/host.com/httpdocs/download/

But this doesn't:
/var/www/vhosts/host.com/download/

I just get a warning in the store:
Warning: The downloadable products directory does not exist:

I'm setting the config.php like this:
define('DIR_FS_DOWNLOAD', '/var/www/vhosts/host.com/download/');
I've even tried changing the 'host.com' directory's owner/group/permissions to match the 'httpdocs' web root directory, but no luck.

1 Aug 2007, 7:33 PM
#2
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

I've even tried changing the 'host.com' directory's owner/group/permissions to match the 'httpdocs' web root directory, but no luck.
You should never do that. You can cause problems for your entire Hosting account. Change permissions back to what they were; ask your Hoster if not sure.

The problem you are having is the the host.com directory is not Publicly available. It is for "your" use only. For files you want to the Public to see, they must be within the httpdocs directory or a subdirectory.

The learning is in the doing.

Potent Products

1 Aug 2007, 8:08 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: can't move download dir. out of the web root.

I assume you've been following one or both of these FAQs:
https://www.zen-cart.com/tutorials/index.php?article=121
https://www.zen-cart.com/tutorials/index.php?article=280

I just get a warning in the store:
Warning: The downloadable products directory does not exist:
Two things:

  1. that message should only occur when PHP attempts to run is_dir() against the folder you entered.
    I'm sure you've created the folder (and not a file) in the right place, but it's worth double-checking.

  2. The message should be longer ... ie: > 'Warning: The downloadable products directory does not exist: /home/path/foldername/etc/. Downloadable products will not work until this directory is valid.'

  3. What version of Zen Cart are you using?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Aug 2007, 10:45 PM
#4
quixotic avatar

quixotic

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

Yes, those are the two articles I followed... It's odd, since everything is happy no matter where I move it, until I put it out of the web root.

That's why I assumed it must be a permissions issue for the directory. Since I've got a VPS running basically only this site, I figured there wasn't much harm in at least trying to set the owner/group/perm for it. But even that didn't work.

...There must be something stupid on the server side that's not letting the download directory be found. Perhaps something I could fix with an .htaccess file?

BTW, thank you all for your replies!

It's the current release. v1.3.7
the warning is longer, I just chopped it for brevity:

Warning: The downloadable products directory does not exist: /var/www/vhosts/host.com/download/. Downloadable products will not work until this directory is valid.

2 Aug 2007, 10:52 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: can't move download dir. out of the web root.

Perhaps your server administrator can help you with determining whether there are restrictions with your PHP accessing files outside the webroot.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 Aug 2007, 12:22 AM
#6
quixotic avatar

quixotic

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

Got it!:laugh:
Stupid me didn't check the log files... it's an **open_basedir **restriction issue.

Hope this helps someone else, if they run into it:

To fix (for Plesk users), SSH to your account. Then:

cd /var/www/vhosts/your_domain.com/conf/

*replace your_domain.com with whatever your domain is everywhere in these instructions.

Create a vhost.conf file (I use the vi editor, you can use whatever you like).

Add these lines to the file:

<Directory "/var/www/vhosts/domain.com/httpdocs">
php_admin_value open_basedir "/var/www/vhosts/your_domain.com/httpdocs/:/var/www/vhosts/your_domain.com/download/"
</Directory>

Tell webserver to use the local conf. file:

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=your_domain.com

Stop and start apache:
/etc/init.d/httpd stop
/etc/init.d/httpd start

I cribbed/modded these instructions from MT.

Thanks again for everyone's input...

16 Oct 2007, 3:11 PM
#7
gxjenkins avatar

gxjenkins

Zen Follower

Join Date:
Apr 2007
Location:
Tampa, Florida
Posts:
180
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

I'm having a problem moving my Download directory also. I'm getting the long error msg:

"Warning: The downloadable products directory does not exist: /home/gxjenkin/public_html/zencart//home/gxjenkin/download/. Downloadable products will not work until this directory is valid."

In the error msg it's showing the old, and new path to Download directory. I've edited both Config.php files, but it's still see the old path somewhere.

Once I change the Config files I'll get this error even if the Download directory is in both places.
Any ideas?
Thanks.

Gary Jenkins
Your Neighborhood Store
It Ain't Over Until You Quit, So Don't!

16 Oct 2007, 3:27 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: can't move download dir. out of the web root.

What version of Zen Cart?
What addons/contributions are installed?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Oct 2007, 10:48 PM
#9
gxjenkins avatar

gxjenkins

Zen Follower

Join Date:
Apr 2007
Location:
Tampa, Florida
Posts:
180
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

I'm using Zen Cart 1.3.7

with:
Easy Populate Advance
User Tracking
Google Feeder
Google Checkout
Google Analytics
Book Product Type
Auction Product Type
UPC/IBSN
Links Manager
FAQ Manager
Return Authorization
Report lower price
Crafty Syntax live help
Jrox Affiliate Manager
News box manager

and there may be one or two I can't remember.

Gary Jenkins
Your Neighborhood Store
It Ain't Over Until You Quit, So Don't!

17 Oct 2007, 3:18 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: can't move download dir. out of the web root.

How exactly did you alter that download line in your configure.php files?

Take a look again at the FAQ ... you need to replace all of the stuff on the right-hand side of the define with your new path, not merely change the word 'download' to your path. The DIR_FS_CATALOG part needs removing if you're wanting to reference stuff outside of it.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Oct 2007, 4:06 AM
#11
gxjenkins avatar

gxjenkins

Zen Follower

Join Date:
Apr 2007
Location:
Tampa, Florida
Posts:
180
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

I only changed the define for Download.
From this: define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
To this:
define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . '/home/gxjenkin/download/');
I see the part about DIR_FS_CATALOG, but it doesn't say how to change it, or that it needs to be.
This is what it looks like now:define('DIR_FS_CATALOG', '/home/gxjenkin/public_html/zencart/');
How would I change this?
Thanks.

Gary Jenkins
Your Neighborhood Store
It Ain't Over Until You Quit, So Don't!

17 Oct 2007, 4:10 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: can't move download dir. out of the web root.

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

becomes this:

define('DIR_FS_DOWNLOAD', '/home/gxjenkin/download/');

ref: https://www.zen-cart.com/tutorials/index.php?article=280

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

18 Oct 2007, 4:34 AM
#13
gxjenkins avatar

gxjenkins

Zen Follower

Join Date:
Apr 2007
Location:
Tampa, Florida
Posts:
180
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

I must have looked at those two lines a thousand times, but never noticed the "DIR_FS_CATALOG" was missing in the changed line.
Thanks much.

Gary Jenkins
Your Neighborhood Store
It Ain't Over Until You Quit, So Don't!

9 Mar 2009, 9:19 PM
#14
trishah avatar

trishah

New Zenner

Join Date:
Feb 2009
Posts:
10
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

I'm bumping this because I am having the same problem. I have followed all the instructions and I still keep getting this error:

Warning: The downloadable products directory does not exist: /home/myweb/public_html/scriptsandsites/download/. Downloadable products will not work until this directory is valid.

I'm thinking this might have to do with the domain zencart is on is a subdomain of myweb.

I'm doing the following:

  1. Edit your two configure.php files to show the new path to your download folder:
    • /includes/configure.php
    • /admin/includes/configure.php
You'll need to edit the line that says this:

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

to look something like this:

define('DIR_FS_DOWNLOAD', '/home/myweb/download_sns/');

Any suggestions?

"Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net

9 Mar 2009, 10:17 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: can't move download dir. out of the web root.

trishah:

Warning: The downloadable products directory does not exist: /home/myweb/public_html/scriptsandsites/download/. Downloadable products will not work until this directory is valid.
That message is telling you that your store is still configured to use the public_html/scriptsandsites/download/ folder.

So, either you didn't edit the configure.php files properly, OR you didn't make the files writable before trying to upload your changes to them, and thus the FTP upload failed, and your edits were discarded.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Mar 2009, 8:03 AM
#16
trishah avatar

trishah

New Zenner

Join Date:
Feb 2009
Posts:
10
Plugin Contributions:
0

Re: can't move download dir. out of the web root.

Why didn't I think of that!

I temporarily changed the chmod from 644 to 777 and re-uploaded both files then chmoded them back to 644 and it worked! No error message now.

Thanks for your help it is greatly appreciated! :bigups:

"Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net