Seven cattle upload file server display 502, how to solve?

Source: Internet
Author: User
Keywords PHP seven Qiniu storage
Tags autoload
Server environment is NGINX+PHP-FPM
With seven cattle php-sdk wrote a file upload demo, local operation is normal, uploaded to the server test the following results:

1. Run command under Server terminal: ' PHP demo.php ', the result is normal, the file is uploaded successfully.
2. Access: ' http://xxx.com/demo.php ' in the browser, then after a long wait to return 502 error, file upload failed.

To the Internet to find some solution to the Nginx 502 error method, but seemingly did not take effect, ask how to solve the problem.

Attach the demo.php code:

<?phpset_time_limit (0); require_once  ' vendor/autoload.php '; use Qiniu\storage\uploadmanager;use Qiniu\Auth ;//The public and private key used for signing $accessKey = ' * * * '; $secretKey = ' * * * '; Initializes the $auth = new Auth ($accessKey, $secretKey) of the Signature object; $bucket = ' blog '; Generate upload token $token = $auth->uploadtoken ($bucket); Build UploadManager Object $uploadMgr = new UploadManager (); $data = file_get_contents (' 11.jpg '); $rt = $uploadMgr->put ($token, substr (MD5 (Time ()), 0,10). JPG ', $data); Print_r ($RT);

Reply content:

Server environment is NGINX+PHP-FPM
With seven cattle php-sdk wrote a file upload demo, local operation is normal, uploaded to the server test the following results:

1. Run command under Server terminal: ' PHP demo.php ', the result is normal, the file is uploaded successfully.
2. Access: ' http://xxx.com/demo.php ' in the browser, then after a long wait to return 502 error, file upload failed.

To the Internet to find some solution to the Nginx 502 error method, but seemingly did not take effect, ask how to solve the problem.

Attach the demo.php code:

<?phpset_time_limit (0); require_once  ' vendor/autoload.php '; use Qiniu\storage\uploadmanager;use Qiniu\Auth ;//The public and private key used for signing $accessKey = ' * * * '; $secretKey = ' * * * '; Initializes the $auth = new Auth ($accessKey, $secretKey) of the Signature object; $bucket = ' blog '; Generate upload token $token = $auth->uploadtoken ($bucket); Build UploadManager Object $uploadMgr = new UploadManager (); $data = file_get_contents (' 11.jpg '); $rt = $uploadMgr->put ($token, substr (MD5 (Time ()), 0,10). JPG ', $data); Print_r ($RT);

Is there still a problem here? Is your server unstable? You may need to purchase a more stable server,

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.