Page 1 of 4 123 ... LastLast
Results 1 to 10 of 35
  1. #1
    Join Date
    Feb 2016
    Location
    Colorado
    Posts
    34
    Plugin Contributions
    0

    Default 500 server error with custom importer when upgraded to php 5.6

    We have a custom import plugin that is now giving a 500 error when since the PHP was upgraded fromm 5.3 to 5.6.

    The error log shows:
    PHP Fatal error: Cannot re-assign auto-global variable _FILES

    Does anyone know why this would give a 500 error, and how to fix it?
    Thanks.

    Zencart 1.54

  2. #2
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: 500 server error when upgraded to php 5.6

    Quote Originally Posted by hp09 View Post
    We have a custom import plugin that is now giving a 500 error when since the PHP was upgraded fromm 5.3 to 5.6.

    The error log shows:
    PHP Fatal error: Cannot re-assign auto-global variable _FILES

    Does anyone know why this would give a 500 error, and how to fix it?
    Thanks.

    Zencart 1.54
    I would safely say that your custom import plugin is not compatible with PHP 5.6 thus causing the 500 error.

    What happens if you temporarily uninstall that plugin?

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    Default Re: 500 server error when upgraded to php 5.6

    $_FILES is a superglobal variable. apparently people had this problem on the change from PHP 5.3 to 5.4.

    depending on what your plugin is doing and how it is using this variable would determine the solution.

    if you have the line number for the error and can post the code, perhaps someone could help. ZC version 1.5.4 is compatible for php 5.6, so no doubt the problem is with the plugin.

    in addition, in your plugin, depending on what it is doing, you "might" be able to change all instances of $_FILES to a local variable, such as $afiles, and it is entirely possible that would work. but without seeing the code and specifically the line where the error is occurring, i'm just taking shots in the dark.

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  4. #4
    Join Date
    Feb 2016
    Location
    Colorado
    Posts
    34
    Plugin Contributions
    0

    Default Re: 500 server error when upgraded to php 5.6

    Thank you for the information.

    The error is in line 3 of the ic_fns.php file (attached).

    Line 3: function import_contacts($_FILES)
    {


    Zencart still does work fine. It's just that this product importer gives the 500 error when the icindex.php page is opened (which has an include for ic_fns.php).

    I took out "$_FILES" in line 3 (and another instance of this on line 233), and no longer got the 500 error. However, the importer no longer worked, so something neds to replace that.

    Thanks for the help.
    Howard
    Attached Files Attached Files

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    Default Re: 500 server error when upgraded to php 5.6

    howard,
    try replacing $_FILES with $afiles in all instances only in the inc_fns.php file.

    so it would look something like this:

    PHP Code:
    function import_contacts($_FILES)
    {
        
    $return_array = array();
        
        
    $in_upfname $_FILES['upfname']['name'];
        
    $tmp_upfname $_FILES['upfname']['tmp_name'];

    // change to

    function import_contacts($afiles)
    {
        
    $return_array = array();
        
        
    $in_upfname $afiles['upfname']['name'];
        
    $tmp_upfname $afiles['upfname']['tmp_name'];

    //also here on line 233:

    function import_contacts_excel($_FILES,$vid,$in_file)

    // change to:

    function import_contacts_excel($afiles,$vid,$in_file
    i think all of the remaining code can stay the same.

    let me know if that works.

    good luck!
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Feb 2016
    Location
    Colorado
    Posts
    34
    Plugin Contributions
    0

    Default Re: 500 server error when upgraded to php 5.6

    Thanks. I just tried that. I don't get the 500 error, and the page opens. But when I try to import a file, it just closes the page and nothing happens, no import.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    Default Re: 500 server error when upgraded to php 5.6

    right now i am at a bit of a loss. no error messages are getting generated? it seems it should say something good happened or something bad happened....

    i take it this operation happens on the admin side of your store?

    are you trying to import an excel sheet or a plain text? there seems to be 2 different types of imports going on. have you tried using the other one?

    i'll think some more on it.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: 500 server error when upgraded to php 5.6

    Several things in this program. Besides that they were passing a global variable ($_FILES) from one area to another (which totally defeats the concept of having a global variable), it does look like the excel version of the import includes yet another file that has not been provided Excel/reader.php which probably also has the $_FILES variable inside of it (instead of the above suggested $afiles), there are also procedure calls to mysql_ functions rather than mysqli_ functions, then there is the little tidbit about the database connection (ummm, would suggest changing your database credentials to that database since it is now posted in plain text yes within a zip file, I understand), which also uses mysql_ functions instead of mysqli_ functions/the ZC database associated with this store. There are possibly error logs being written, because there is error handling provided in the files (assuming processing gets past the db_connect2() function) to write to one or more error files on the server and there probably are some other coding issues, considering the technique used to address the above.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Feb 2016
    Location
    Colorado
    Posts
    34
    Plugin Contributions
    0

    Default Re: 500 server error when upgraded to php 5.6

    Yes, this is on the admin side. I am trying to import an Exccel file. I didn't know it could import plain text.

    As far as the DB credentials, I realized that after I posted it, but they have been changed. Is there any way to delete anattachment form a post?

    I will check the logs to see if anything else showed up.

    Thanks.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: 500 server error when upgraded to php 5.6

    Quote Originally Posted by hp09 View Post
    Yes, this is on the admin side. I am trying to import an Exccel file. I didn't know it could import plain text.

    As far as the DB credentials, I realized that after I posted it, but they have been changed. Is there any way to delete anattachment form a post?

    I will check the logs to see if anything else showed up.

    Thanks.
    I thought that there was an option to remove uploaded files somewhere in the ZC settings/my profile area, which would leave the above link, but remove the object on the other end. Otherwise, contacting forum support (I usually change my forum template so that the link appears at the bottom of the page.) Or could report the post and request the file be removed/modified.

    As said may have log files as defined in the code to be stored wherever it puts those files. It appears that most of this code works outside of standard ZC code and only interfaces with the database as "necessary".
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. v139d 500 server error on custom plugin when upgraded beyond PHP 5.3
    By hp09 in forum General Questions
    Replies: 2
    Last Post: 16 Feb 2016, 12:18 AM
  2. v151 500 Internal Server Error when installing
    By WorldOfMine in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 8 Oct 2015, 07:03 AM
  3. trouble moving site - php error 500 server error
    By gregorw in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 28 Mar 2012, 05:50 PM
  4. Replies: 2
    Last Post: 11 Nov 2009, 12:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR