Customer cannot download files anymore!

Fatal error: Call to undefined function apache_setenv() in /home/silverc7/public_html/core/fn.fs.php on line 238



That’s the error message that suddenly appears when trying to download purchased files.



And NO, I did not change anything on the shop or server… just appeared out of the blue today !!



Any ideas anyone !? My shop is now useless ! :confused: :frowning:

You had to have just upgraded your store to version 2.1 because that function didn’t exist in previous releases



Try this fix

[url]http://forum.cs-cart.com/showpost.php?p=91363&postcount=50[/url]

Hi S,



well, yes, I upgraded over a week ago… true, I don’t sell that many products yet, so maybe it escaped because of that.



already spotted the thread you point to, but didn’t figure it was the same problem.

Will try it out, thanks… !



F.

Alas… now I get a Server 500 error, so the problem isn’t fixed. Will post a trouble ticket.

Your server may be rejecting the .htaccess entry… Try removing that and see if the error goes away.

Already tried that and it didn’t make a difference. Same error. I am not using gzip, but regular .zip files. Should that make a difference?

Had the same error.



Fixed by reverting to the core/fn.fs.php file from version 2.15

[quote name=‘Hetha’]Had the same error.



Fixed by reverting to the core/fn.fs.php file from version 2.15[/QUOTE]





Reverting that single file will cause other problems Hetha because of other changes made within it.



For example:



fn_file_put_contents has been replaced with file_put_contents

Hmmm… meanwhile I am still stuck with angry customers, a shop that doesn’t work and no word from ‘support’.



NOT a happy camper, :frowning:

[quote name=‘Navvie’]Hmmm… meanwhile I am still stuck with angry customers, a shop that doesn’t work and no word from ‘support’.



NOT a happy camper, :([/QUOTE]



I was waiting to see if your problem was resolved via your trouble ticket.



The code modification I suggested to fn.fs.php would not cause the 500 errors if applied correctly but the .htaccess addition could on certain servers depending on how they are configured. Incorrect file/directory permissions and ownership can also give these errors.



I would need FTP access to further diagnose and help with this problem.



To answer your question above about gzip:



gzip (as we are referring to it) is a method of server side compression and cs-cart is attempting to disable this process during file downloading because it can often corrupt them.

I certainly appreciate your efforts in helping, but, are you an employee of CS-cart ???

I am somewhat reluctant to give ‘just anybody’ access to my server(s). I just spent the better part of my weekend solving virus attacks and trojan problems on some customer’s sites and am a tad ‘annoyed’ - to put it mildly.



Also wondering why the CS-cart company cannot provide support to their product (assuming YOU are not an official support person) ??? (Just checked, nobody seems to have even looked at my trouble ticket yet… :confused: ).



I’ll try your solution one more time, but I would expect a patch from CS-cart if this indeed is the reason for the problems. I’ll lose the ‘mod’ with the next upgrade otherwise!

I am not an employee of cs-cart but do host over 100 stores Navvie.

So you must have been frustrated by that company a few times I take it ? :eek:



I’ll try one more time later this afternoon and will let you know. Thanks for helping in any case :slight_smile:

[quote name=‘Navvie’]So you must have been frustrated by that company a few times I take it ? :eek: [/QUOTE]



They keep me busy :stuck_out_tongue:

The lines from the log after the 500 error say this:



[Sun Aug 15 09:23:51 2010] [error] [client xxx] File does not exist: /home/silverc7/public_html/favicon.ico

[Sun Aug 15 09:23:50 2010] [error] [client xxx] malformed header from script. Bad header=200 HTTP/1.0 OK: /home/silverc7/public_html/admin-owner.php



admin-owner.php is again a Simbirsk file, but not much in it.

well that is a new error and challenge… Again this is related to your hosting environment/server settings.



Try this



Go back into fn.fs.php and comment out the following line (near line 240)

```php header (“200 HTTP/1.0 OK”); ```

change to

```php //header (“200 HTTP/1.0 OK”); ```



See if that will help and please reply with result

Scott, that WORKED ! Thank you!



Strangely enough I could not log in to these forums anymore via the link I used before (saved in my Firefox). I finally got back in through Google-ing… weird !!

Hence the delay in replying to you.



Cannot access the Helpdesk link for the same reason it seems.

Glad it finally worked out Navvie



I was having problems loading this site also last night. cs-cart.com has DNS problems right now. It appears that 2 of their name servers are down.

That would explain why I can only get in through a ‘detour’ :slight_smile:



I see more people have the same problems (re: the download files). I also (at last!) got a reply from ‘support’, pointing me to the same thread you pointed me to. Still not impressed with the company :wink:



Kind regards,

Francois

Have now had time to go through all the code changes in the new fn.fs using beyond compare and have managed to identify the pieces of code causing us problems -



header (“200 HTTP/1.0 OK”);



was causing server misconfiguration error - fixed by changing to



//header (“200 HTTP/1.0 OK”);





apache_setenv(“no-gzip”, “1”);



was causing internal server error 500 - fixed by changing to



if (function_exists(‘apache_setenv’)) {

apache_setenv(‘no-gzip’, ‘1’);

}



and



.htaccess file placed in downloads folder var/downloads CHMOD 755 containing



RewriteEngine on

RewriteRule . - [E=no-gzip:1]





Now all working fine