Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can someone help with this error - fopen.....


Clint Fern

Recommended Posts

Hi,

 

Can someone point me in the right direction with this problem. I'm not sure if it's a gpg or a php problem.....

 

The error messages I get running the cc module are ;

 

Warning: fopen("/usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/tmp/46db680d4279f2037c56fd6e6403ec23anca.asc", "r") - No such file or directory in /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php on line 281

 

Warning: stat failed for /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/tmp/46db680d4279f2037c56fd6e6403ec23anca.asc (errno=2 - No such file or directory) in /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php on line 282

 

Warning: fread(): supplied argument is not a valid File-Handle resource in /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php on line 282

 

Warning: fclose(): supplied argument is not a valid File-Handle resource in /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php on line 283

 

Warning: unlink() failed (No such file or directory) in /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php on line 285

 

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php:281) in /usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/catalog2/catalog/includes/functions/general.php on line 23

 

 

I'm using a pre-Nov release and v0.92 of the contribution - Linux host.

 

The script is running from httpsdocs/catalog2/catalog/includes/modules/payment/ccgpg.php

 

the pubring is in httpdocs/keyring/ - in this folder is just the pubring.gpg file (no other file, no sub .gnupg folder) - this works to unencrypt an e-mail on my own computer. Keyring folder is chmod 777 although httpdocs isn't.

 

the tmp directory is in httpsdocs/tmp - it is chmod 777 (although obviously httpsdocs isn't)

 

The code is as follows -

 

if ( (defined('MODULE_PAYMENT_CCGPG_ENCRYPT')) && (MODULE_PAYMENT_CCGPG_ENCRYPT == 'GPG') ) {

$message = 'Order #' . $insert_id . "nn" . 'Number: ' . $GLOBALS['cc_toencrypt'] . "nn";

$tmpToken = md5(uniqid(rand()));

$plainTxt = "/usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/tmp/" . "$tmpToken" . "anca";

$crypted = "/usr/local/psa/home/vhosts/pipersfarm.com/httpsdocs/tmp/" . "$tmpToken" . "anca.asc";

// $gpghome="/usr/local/psa/home/vhosts/pipersfarm.com/home/pubring.gpg"; //where is your pubring? That dir has to have write access.

$gpghome="/usr/local/psa/home/vhosts/pipersfarm.com/httpdocs/keyring/"; //where is your pubring? That dir has to have write access.

$gpgpath="/usr/local/bin"; //where is the executable -this must be the correct path to gpg

$gpgrecipient="Richy Brigham (pipersfarm.com) <[email protected]>"; //the key used for encryption

$fp = fopen($plainTxt, "w+");

fputs($fp, $message);

fclose($fp);

system("export HOME=" . $gpghome . " ;" . $gpgpath . " --batch --always-trust --quiet --no-secmem-warning --compress-algo 1 -ear '" . $gpgrecipient . "' $plainTxt");

$fd = fopen($crypted, "r");

$message = fread($fd, filesize($crypted));

fclose($fd);

unlink($plainTxt);

unlink($crypted);

tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, 'Extra Order Info', $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

//tep_mail('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

}

}

 

 

I know this is elsewhere in the archive - but there doesn't appear to be a resolution - can anyone suggest what might be causing this

 

 

Thanks in anticipation of help

Clint

Link to comment
Share on other sites

  • 3 weeks later...

The problem is occuring when gpg is invoked. The file errors you get from php refer to the fact that the $crypted file is not being written by the gpg program and so cannot be opened for inclusion in the email by the php script. Check your path to gpg and the manner in which you are trying to invoke it. Also try echoing the results of the system call to a file by appending:

 

2> /full/path/to/a/writeable/directory/errors

 

to the end of your gpg invocation line. This will create an errors file in the directory you specify with the output from gpg. This is necessary because the system call doesn't return a string value to echo out (at least not consistently).

 

HTH

 

Evan Brown

Link to comment
Share on other sites

  • 1 year later...

Hi Clint,

 

I dont know if you will see this message, or if you are even still on this forum, but...were you ever able to take care of this issue? If so, how did you do it?

 

Thanks.

 

 

Dean.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...