If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / PayPal Express Checkout support / IPN Not Working Properly and No Digital Product Download Link Displayed

IPN Not Working Properly and No Digital Product Download Link Displayed

Locked

Started by joolrod on 20 Jun 2019, 7:46 AM · Views: 16,268

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
20 Jun 2019, 7:46 AM
#1
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #1 by joolrod

Hello and i have been trying for some time to find why i get these errors when running the ipncheck.php script. I am setting the shop up to use paypal express checkout.

Today i did a test purchase of a digital download product through paypal to buy a product and all seemed okay with paypal payment. Paypal redirected me back to my shops Success Page which showed the purchase details.

I clicked on to step 3 of 3 Order Confirmation. After clicking the "Confirm The Order" button, the next "Order Information" page has all the details of the purchase but No Download Link as it is a downloadable product.

On this page it shows the link expiry as 06/27/2019 and the remaining downloads as 2 but still No Download Link.

So I assume that because the IP Check is failing, this affects whether the download link is displayed.

I use zen cart version: V1.5.4
my server PHP Version: V5.6.4
Website URL is https://www.joolrod.com/shop

Here is the errors when i run the ipncheck.php in the shop directory.

IPNCHECK.php RESULT::

IPNCHECK.PHP - Version 1.3.9

CURL ERROR: Attempted connection on: https://www.paypal.com/cgi-bin/webscr
(7)
Trying direct HTTP on port 80 instead ...
CURL ERROR: Attempted alternate connection on: http://www.paypal.com/cgi-bin/webscr
(7) 
ABORTING CURL METHOD ...
FAILED
IPN ERROR :: Could not establish fsockopen: 
Host Details = ssl://www.paypal.com:443 (13) Permission denied
 Trying again with HTTPS over 443 ...
IPN ERROR :: Could not establish fsockopen: 
Host Details = https://www.paypal.com:443 (0) Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?
 Trying again directly over 443 ...
IPN ERROR :: Could not establish fsockopen: 
Host Details = www.paypal.com:443 (13) Permission denied
 Trying again with HTTP over port 80 ...
IPN ERROR :: Could not establish fsockopen: 
Host Details = httpwww.paypal.com:80 (0) php_network_getaddresses: getaddrinfo failed: Name or service not known
 Trying again without any specified protocol, using port 80 ...
IPN FATAL ERROR :: Could not establish fsockopen. 
Host Details = www.paypal.com:80 (13) Permission denied

Any assistance would be appreciated.

Regards Rodney

20 Jun 2019, 7:34 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #2 by mc12345678

These two issues may or may not be related.

From the Zen Cart side, does the purchase appear to be complete from within the orders area, or is the money still considered to be waiting receipt?

Need to also look at the settings along with the order status. The settings in question are in configuration->Attribute Settings and relate to the minimum and maximum values for supporting download.

Then need to look at the attributes controller for this downloadable product. What are the days and number of downloads initially applied? Are they 7 and 2?

Then also look at products->download Manager, does this downloadable product have a green light next to the attribute/file? The idea being to verify that the file actually is properly associated with the download identifier.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

21 Jun 2019, 7:10 AM
#3
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #3 by joolrod

I have now done a new test purchase then rechecked the admin are for the answers to your questions as follows:

  1. The Payment Status shows as 'Completed' in the order details.
  2. Download Lower limit is 2 and the upper value is 4
  3. The 'Expiry Days' is 7 and the 'Max Download' count is 3
  4. The product has a red light so I redid the filename for it and it is now a green light.

I then did a test purchase and success, the download button was there. But now after clicking the 'Download Button' i get and error screen => Access Forbidden ...... error 403

Thanks very much so far we are almost there i am sure..

Look forward to your reply

Cheers Rodney

21 Jun 2019, 1:23 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #4 by mc12345678

I have a few things that might cause this though I am again throwing out possibilities based on the lack of some information. BTW, you've done a good job explaining the results of doing something, just need to work on explaining how others can independently reproduce the issue. Something you'll get even better at as you use the software.

In no particular order:

  1. What is the extension of the file and is it supported by the .htaccess in your downloads directory?
  2. If you were to ftp or ssh to your site and look at the permissions of a few of the folders such as the includes folder, the admin folder, and perhaps the logs folder. Are they all 777, 755 or some other permission level?
  3. Even though I don't suspect it to be the issue in Zen Cart 1.5.4 based on how downloads were being done, I need to ask to eliminate the possibility. If you look at (or post) your includes/configure.php up to the point of the database information (or the whole thing but obscure the credentials part), what is the structure of HTTP_SERVER, HTTPS_SERVER, DIR_WS_CATALOG, DIR_WS_HTTPS_CATALOG, and ENABLE_SSL?

I ask because before Zen Cart 1.5.5 the downloads process seemed to work regardless where the sub-folder was placed, but with some new capability in I think 1.5.5 and definitely in 1.5.6, if the sub-folder were misplaced then the file would not be retrieved from the proper location.

OK, that's as much as I can think of at the moment as to the basic (likely) reasons a 403 would occur on selection of a download.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jun 2019, 10:35 AM
#5
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #5 by joolrod

Thanks again for your hard work, and here are the answers you requested:

  1. The file extension is .zip and yes that is supported in the .htaccess file in the downloads directory.

  2. includes = 0755 admin = 0755 logs = 0755

  3. the complete configure.php follows with modified database credentials:

<CODE> <?php /** * @package Configuration Settings circa 1.5.3 * @copyright Copyright 2003-2014 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * File Built by zc_install on 2014-07-21 01:29:27 */

/*************** NOTE: This file is similar, but DIFFERENT from the "store" version of configure.php. /
/
**** The 2 files should be kept separate and not used to overwrite each other. ***********/

/**

  • WE RECOMMEND THAT YOU USE SSL PROTECTION FOR YOUR ENTIRE ADMIN:
  • To do that, make sure you use a "https:" URL for BOTH the HTTP_SERVER and HTTPS_SERVER entries:
    */
    define('HTTP_SERVER', 'http://www.joolrod.com');
    define('HTTPS_SERVER', 'https://www.joolrod.com');
    define('HTTP_CATALOG_SERVER', 'http://www.joolrod.com');
    define('HTTPS_CATALOG_SERVER', 'https://www.joolrod.com');

// secure webserver for admin? Valid choices are 'true' or 'false' (including quotes).
define('ENABLE_SSL_ADMIN', 'false');

// secure webserver for storefront? Valid choices are 'true' or 'false' (including quotes).
define('ENABLE_SSL_CATALOG', 'false');

define('DIR_WS_ADMIN', preg_replace('#^' . str_replace('-', '-', zen_parse_url(HTTP_SERVER, '/path')) . '#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/');
define('DIR_WS_CATALOG', '/shop/');
define('DIR_WS_HTTPS_ADMIN', preg_replace('#^' . str_replace('-', '-', zen_parse_url(HTTPS_SERVER, '/path')) . '#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/');
define('DIR_WS_HTTPS_CATALOG', '/shop/');

// 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_IMAGES', 'images/');
define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
define('DIR_WS_CATALOG_IMAGES', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'images/');
define('DIR_WS_CATALOG_TEMPLATE', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'includes/templates/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
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_CATALOG_LANGUAGES', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'includes/languages/');

// * DIR_FS_* = Filesystem directories (local/physical)
define('DIR_FS_ADMIN', preg_replace('#/includes/$#', '/', realpath(dirname(FILE) . '/../') . '/'));
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', '/home/www/joolrod.com/shop/');

//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', '/home/www/joolrod.com/shop/logs');

define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
define('DIR_FS_CATALOG_TEMPLATES', DIR_FS_CATALOG . 'includes/templates/');
define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');
define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');
define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

// define our database connection
define('DB_TYPE', 'mysql'); // 'mysql');
define('DB_PREFIX', 'zen_');
define('DB_CHARSET', 'utf8');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'USENAME');
define('DB_SERVER_PASSWORD', 'PASSWORD');
define('DB_DATABASE', 'DATABASE_NAME');

// 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', 'database');
define('DIR_FS_SQL_CACHE', '/home/www/joolrod.com/shop/cache');

// Define the webserver and path parameters
// Main webserver: eg-http://www.your_domain.com -
// HTTP_SERVER is your Main webserver: eg-http://www.your_domain.com
// HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com
// HTTP_CATALOG_SERVER is your Main webserver: eg-http://www.your_domain.com
// HTTPS_CATALOG_SERVER is your Secure webserver: eg-https://www.your_domain.com
/*

  • URLs for your site will be built via:
  • HTTP_SERVER plus DIR_WS_ADMIN or
    
  • HTTPS_SERVER plus DIR_WS_HTTPS_ADMIN or
    
  • HTTP_SERVER plus DIR_WS_CATALOG or
    
  • HTTPS_SERVER plus DIR_WS_HTTPS_CATALOG
    
  • ...depending on your system configuration settings
    */
    // EOF
</CODE>

Well I hope i have covered all the questions for you. Also when i did the test purchase yesterday and as i have debug on the curl etc is still throwing errors as the test script did above.

Any-way thanks a lot for all your assistance and if you need any other info just let me know.

Kind Regards
Rodney

22 Jun 2019, 11:50 AM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #6 by mc12345678

I forgot to mention/request that all the code be inserted between ```
[CODE][/CODE]


Anyways, it would be my guess that the symlink generated to support "anonymous" download is possibly being rejected by the server because it is being created with 0777 permissions.

For ZC 1.5.3 (sorry you're working with 1.5.4 although your provided admin's configure.php file indicates 1.5.3) is done in: includes/modules/pages/download/header_php.php

Search for 0777
Replace with 0755

I expect the line to look like:

mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);

And then after change to be like:

mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0755);


Login to the account, go to the recent purchase and attempt to download. Would expect it to work this time. If desired as necessary, make the purchase again and attempt to download.


 Another question to somewhat close the loop on order status, if you go to localization->orders status, are you able to identify the id associated with each of the order statuses? Pending is typically 1... when selecting to edit an order status, there is information that is added to the browser address. That information would help identify which is which...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jun 2019, 1:33 PM
#7
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #7 by joolrod

Hello again and thanks.

Firstly to clear up some-thing, you mentioned that i provided admins configuration data but that is not the admins as i copied the configuration in the shops root directory. And i also see there is a configure.php in the includes/ sub directory. Both of these say v1.5.3.
The one in the admin directory is named 'configuration.php' and says it's version V1.5.4.

I have upgraded so years back to the current version V1.5.4 so has that upgrade left one of these configuration files in the wrong place?

Which should i remove from the shops scripts that should not be there?

Now I updated the header_php.php file and tried the download but it still has the same error as below:-

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
www.joolrod.com
Apache 

Not sure what you want me to do with the last part being the order status and i did notice that clicking each order status that it added 1 to 4 to the address bar for each status.

Well hope that helps to solve this and look forward to your reply..

Kind Regards
Rodney

22 Jun 2019, 3:02 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #8 by mc12345678

Neither should be removed. And yes, something done during the upgrade probably caused the admin version of the file to be placed in the catalog side. An example of the defines that should be in the file should be locatable in includes/dist-configure.php. Basically there are extra defines declared in the file that are unnecessary and fortunately because of the auto-define nature of the admin information, no admin folder information is actually made available from the catalog side.

Technically, if the upgrade had been performed by these instructions then the includes/configure.php file would be expected to show version 1.5.4 in the header of the file.http://www.zen-cart.com/entry.php?3-How-do-I-rebuild-my-site-on-the-new-version-instead-of-upgrading

As to the download issue. Is this message still the same as before the file permissions change? What are the permissions of the pub folder (if it exists)? What are the contents of the .htaccess in the pub folder? And while I don't recall/haven't gone back to look, is the download method (configuration->attribute settings) set to redirect?

Oh, and the order status part. Just trying to close the loop on it. Based on the current order status for this download "purchase", what identification number is assigned to that order status?
(order history claims it as what, completed? When reviewing the list of order status options, what identifier is assigned for order status completed? Is that number within the range of allowing an item to be downloaded?) I am starting to think this is unnecessary information for your issue, but may help someone else.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jun 2019, 4:17 PM
#9
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #9 by joolrod

Hello again and thanks for helping me its really appreciated.

Now here is some answers to the above:

  1. The pub folder permissions are 0755

  2. There is no .htaccess file in the pub folder only an index.html file

  3. Download by redirect - true download by streaming = false

  4. The order status for the product purchased is "processing" in the 'customers=>orders' section of admin.

Hope that helps you pinpoint the problem.

Kind Regards
Rodney

24 Jun 2019, 8:02 AM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #10 by mc12345678

If there is not an .htaccess file, that may be a source of the problem. As seen here: https://github.com/zencart/zencart/tree/v154/pub there are to be at least two files. The htaccess and the index.html. But... it may also be that your file viewer is hiding the .htaccess files because afterall it is hidden... I also say this because a hidden file should have been created when attempting to download the file. And that too should be/have been present. Note that files (and folders) that begin with a period are typically treated as hidden files.

Now, that said as well, was the server type for this installation identified and that it was windows based?

As for the order status information, helps to continue putting things together, but still need to tie the minimum number found in configuration->attribute settings and maximum number listed there with the current number value(s) for the actual order statuses.

So I've gone back to a newly installed store to pull up the browser path for clicking on the order status of delivered and it is this: admin/orders_status.php?page=1&oID=3 which means that the orders status of delivered has a value of 3 as shown with oID=3.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Jun 2019, 2:39 AM
#11
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #11 by joolrod

Well i need to apologise, after reading your post about hidden files i thought i better recheck the pub directory on the server and it was not there then rechecked the winSCP FTP software setting and sure enough, the option for viewing hidden files was not checked. It was checked as i have always seen the hidden files but i did upgrade it recently so maybe that changed the settings. Any-way i am so glad i double checked that so sorry for misleading you.

Now there is the .htaccess file in the PUB directory. Also i have 3 hidden sub directories which each have one copy of the download software zip file. The permissions for these files and directories are as follows:-

pub directory = 0755
.htaccess file = 0644
3 x hidden sub-directories = 0755
3 x hidden zip files = 0777

The configuration order status's are as follows:-
configuration->attribute settings-> minimum number = 2 the maximum number = 4

My joolrod.com webserver is unix based

I hope that i have covered all of your queries and thanks heaps for your continued assistance, it's much appreciated.

Kind Regards
Rodney Dickson

2 Jul 2019, 11:06 AM
#12
joolrod avatar

joolrod

New Zenner

Join Date:
May 2019
Location:
Adelaide
Posts:
17
Plugin Contributions:
0

Post #12 by joolrod

Well It's Still NOT Working so if anyone has any ideas i would be very appreciative.

Also as i first stated at the start of this problem, in running the IPNCHECK.PHP script supplied by zen cart, which runs independantly to the store script, HAS ERRORS as shown above.

So I would say that until that script runs with no errors, and so the stores ipn script also has errors and fails then of course no downloads would be permitted by the script as the ipn script has not said that the purchase is legitimate????

Any-way any assistance would be appreciated.

Thanks In Advance
Rodney