require_once PHP 500 Internal Server Error

I am trying to use SDK PHP. but I always get 500 Internal Server Error.

This error is produced when i try to make:    require_once 'BasicClient.php';

The include_paths are correct.    Any clue?

9replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • You can try to get more information about the 500 error by adding this to the top of your script:

    // Remove these two lines before going to production
    ini_set('display_errors', 'On');
    error_reporting(E_ALL);
    
    Reply Like
  • Yes, i see the problem now;

    Parse error: syntax error, unexpected '[' in /var/www/vhosts/.../Client.php on line 139

    it is a bug in the class. I paste here this code:

    136         // Convert data, which could have a resource, into string to send.
    137         if (is_null($data)) {
    138             $data = '';
    
    139         } elseif (is_resource(array_values($data)[0])) {
    140             $boundary = "----------------------------" . uniqid();
    141             $content_type = "multipart/form-data; boundary=$boundary";
    
    Reply Like
  • What version of PHP are you using?

    Reply Like
  • PHP 5.3.3 (cli) (built: Aug  6 2014 05:54:27)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
        with the ionCube PHP Loader v4.0.14, Copyright (c) 2002-2011, by ionCube Ltd.
    
    Reply Like
  • I have PHP 5.5.0. Interesting that so close in version there is a syntax difference.

    Reply Like
  • Yes, it seems so. Array dereferencing is supported from PHP 5.4 onwards 

    http://stackoverflow.com/questions/21499999/php-parse-error-syntax-error-unexpected

    Ryan , thank you so much for your help!

     

    Kind Regards

    Reply Like
  • I made a commit that should work for older version of PHP.

    https://github.com/smartfile/client-php/commit/f3b7c9b2e3307d89faaa31a33119992dc95d26a4

    Reply Like
  • there is another bug :

    Line:221

    list($ignored, $http_status, $ignored) = split(' ', $headers);

     

     Function split() is deprecated

    Reply Like
  • Thanks for letting us know.

     

    Deprecated is not really a bug. It just means that the function will be going away in a future version of PHP.

     

    If you know what function replaces it, you can fix it and submit a pull request in github. ;)

    Reply Like
Like Follow
  • 5 yrs agoLast active
  • 9Replies
  • 2158Views
  • 2 Following