If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / 403 error and Symlink Folders with downloadable products

403 error and Symlink Folders with downloadable products

Locked

Started by luke_galyan on 5 Jul 2014, 1:41 AM · Views: 856

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
5 Jul 2014, 1:41 AM
#1
luke_galyan avatar

luke_galyan

New Zenner

Join Date:
Jun 2014
Location:
Las Vegas, Nevada, United States
Posts:
47
Plugin Contributions:
0

403 error and Symlink Folders with downloadable products

I am having trouble with downloadable products using ZenCart 1.5.2 When I attempt to download via the download button I get a 403 forbidden error. ANY help would be appreciated. Below is what I have tried and what I am thinking to help clear things up for anyone wishing to lend a hand.

I have moved and renamed my downloads folder to above the store root.

I know my admin/configure.php file has the correct reference to the files since I have green dots next to the downloads in my admin. I even made an incorrect entry to see the dots turn red to confirm I was changing the correct file. Then changed the entry back to the correct path.

I am able to complete the purchase of a downloadable file. And am using the redirect option and I am on a Linux server.

I know the includes/configure.php also has the correct path defined for the new location of the download folder. In the customer user account on my store the download button does show after purchase. I found I had not changed my includes/configure.php file and did not have the download button. After making the correct path entry in the file the download button shows up.

I have tried the test solution suggested on the first page of this thread http://www.zen-cart.com/showthread.php?44762-403-Forbidden-error-when-updating-product&highlight=403+forbidden and still have the 403 forbidden error.

I have found references to modifying the .htaccess files to allow my file type (in this case it is a single gpx file for GPS data). I have modified a few .htaccess files with no success. Honestly I am confused as to which .htaccess to play with to allow things?

Something that is confusing me is,…… I thought that when using the redirect download method that symlinks would be created in the pub folder. This is not happening with my installation. New folders for the download are created in the main store directory. Is this normal behavior? With the current folder creation for symlinks behavior the main store folder will quickly be cluttered with a LOT of these extra symlink folders (I will have a lot of dowmnloads).

So can anyone point me in the right direction? Is it a .htaccess issue? Is it something my server provider needs to address? Is it the synlinks being added to the main directory and not the pub folder? Is it something else? Any thoughts would be helpful. This is one of the last steps before my store is ready to go online.

Update:
I found this after writing all this.
I tried to log in with my phone rather than my computer. When I try to download the file I am given a 403 Permission denied error BUT given more information. The link points to a symlink folder/file located in my pub folder. As I see in my ftp the symlink folders are not being created there but instead are in the main store directory. Feels like my solution lies in the location of the symlink folders?

I was going to try to move one of the folders to the pub folder and see if it worked. But I found that each time the link is tried it creates a new folder with a new name. I wanted to create a folder in the pub folder to see if the link then worked. However without knowing what the name will be I can’t.

Thanks
Luke

5 Jul 2014, 1:44 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 403 error and Symlink Folders with downloadable products

Check and see if the file:
/includes/modules/pages/download/header_php.php

is actually on your server ...

If not, contact your hosting provider and have them approve that file ...

Some hosting providers temporarily queue that file for review before they approve it for your server due to the symbolic link reference in it ... if so, once they approve the file, it will appear on your site ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Jul 2014, 11:33 PM
#3
luke_galyan avatar

luke_galyan

New Zenner

Join Date:
Jun 2014
Location:
Las Vegas, Nevada, United States
Posts:
47
Plugin Contributions:
0

Re: 403 error and Symlink Folders with downloadable products

Ajeh:

Check and see if the file:
/includes/modules/pages/download/header_php.php

is actually on your server ...

The file is on my server. I am no coder so I could be interpreting this incorrectly. Looking at the contents of the header_php.php file I see this is the file that creates a random name of 16 to 20 characters long for the symbolic link folder. As stated in the original post the symbolic link folders ARE being created (unfortunately in the store root and not in the pub folder). Since the randomly named symbolic link folders are being created I also assume this header_php.php file is actually being called and used.

I still need help if you have thoughts?
How can I get the symlink folders/links to be created in the pub folder and not the store root.
How can I find out what is causing the 403 error?

Got any other ideas? I am all ears.
Thanks
Luke

8 Jul 2014, 12:53 AM
#4
luke_galyan avatar

luke_galyan

New Zenner

Join Date:
Jun 2014
Location:
Las Vegas, Nevada, United States
Posts:
47
Plugin Contributions:
0

Re: 403 error and Symlink Folders with downloadable products

Not sure if this is of any significance?....

The symlink folders being created in my store root are named like this,
DIR_FS_DOWNLOAD_PUBLIC.hwmcoidijrtkkujdqsmm-1404777867

It seems like the DIR_FS_DOWNLOAD_PUBLIC portion of that name should not be there.

should the symlink folder name instead be called
.hwmcoidijrtkkujdqsmm-1404777867
Then placed in the pub folder of my store?

The pub folder of my store is defined in the configure.php file with the line
define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');

Is it possible that the header_php.php file is using the DIR_WS_DOWNLOAD_PUBLIC as a string to add to the symlink folder name instead of using it to reference the pub folder?

When a user click on the download link a symlink is created.
What I see happening looks like this in the tree structure of the store
catalog/DIR_FS_DOWNLOAD_PUBLIC.hwmcoidijrtkkujdqsmm-1404777867

Shouldn't it look like this instead?
catalog/pub/.hwmcoidijrtkkujdqsmm-1404777867

Luke

8 Jul 2014, 4:44 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: 403 error and Symlink Folders with downloadable products

Luke Galyan:

Shouldn't it look like this instead?
catalog/pub/.hwmcoidijrtkkujdqsmm-1404777867
Yes.

So, your /includes/configure.php file appears to be missing a bunch of important stuff, namely at least the lines highlighted below:```
// Define the webserver and path parameters// HTTP_SERVER is your Main webserver: eg-http://www.yourdomain.com
// HTTPS_SERVER is your Secure webserver: eg-https://www.yourdomain.com
define('HTTP_SERVER', 'http://localhost');
define('HTTPS_SERVER', 'https://localhost');

// Use secure webserver for checkout procedure?
define('ENABLE_SSL', 'false');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!

// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

define('DIR_WS_IMAGES', 'images/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', '/');
//the following path is a COMPLETE path to the /logs/ folder eg: /var/www/vhost/accountname/public_html/store/logs ... and no trailing slash
define('DIR_FS_LOGS', DIR_FS_CATALOG . '/logs');

[B]define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');[/B]
[B]define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');[/B]
define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');
define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);
define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');

// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', ''); // prefix for database table names -- preferred to be left empty
define('DB_CHARSET', 'utf8');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', '');
define('DB_SERVER_PASSWORD', '');
define('DB_DATABASE', '');

// The next 2 "defines" are for SQL cache support.
// For SQL_CACHE_METHOD, you can select from: none, database, or file
// If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache
// or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
// ie: /path/to/your/webspace/public_html/zen/cache -- leave no trailing slash
define('SQL_CACHE_METHOD', 'none');
define('DIR_FS_SQL_CACHE', '/enter/your/path/to/public_html_or_htdocs/and/zencart/here/zen/cache');

.
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.

12 Jul 2014, 4:15 PM
#6
luke_galyan avatar

luke_galyan

New Zenner

Join Date:
Jun 2014
Location:
Las Vegas, Nevada, United States
Posts:
47
Plugin Contributions:
0

Re: 403 error and Symlink Folders with downloadable products

Sorry for the late reply.
As I was playing with this I noticed the new ZenCart version was put up 1.5.3
I decided to bite the bullet and wipe my store out entirely and start over with the new one.
I did not want to introduce any errors on my part by doing an upgrade and thought it would be fairly quick to redo it all since I take a LOT of notes when I do stuff.
So the new version is in and the downloads appear to be working as desired now. woo hoo!
Sorry to those who may have the same issue and looking for an answer but I did not see this one through since the new version came out.

DrByte and Ajeh, thank your for taking the time to reply!

I do have another issue I need to get solved but that obviously needs to be a new thread.
Luke

13 Jul 2014, 1:42 AM
#7
drbyte avatar

drbyte

Sensei

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

Re: 403 error and Symlink Folders with downloadable products

Thanks for confirming that things are fine using the latest version.

Best of success with your store!

.
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.