danipragustia / php-videoproxy-gdrive

Proxy video for Google Drive
GNU Affero General Public License v3.0
19 stars 15 forks source link

Error : syntax error, unexpected '=>' (T_DOUBLE_ARROW) #9

Closed kaizoku75 closed 3 years ago

kaizoku75 commented 3 years ago

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in index.php on line 16

danipragustia commented 3 years ago

You need upgrade your PHP version, because Arrow Function V2 (https://wiki.php.net/rfc/arrow_functions_v2) only available on PHP 7.4+

danipragustia commented 3 years ago

If you stuck on PHP 7.3 for some reason, you can change this line https://github.com/danipragustia/php-videoproxy-gdrive/blob/51962d3213f479a46a78dd5705f85f4c407bce15/index.php#L16

with

array_map(function($x) { header($x); }, $header);

kaizoku75 commented 3 years ago

it work on localhost but on my server nothing "This page isn’t working"

danipragustia commented 3 years ago

You need enable error reporting by changing this line to error_reporting(1) and see log what cause the error. https://github.com/danipragustia/php-videoproxy-gdrive/blob/51962d3213f479a46a78dd5705f85f4c407bce15/index.php#L4

When troubleshooting error, make sure your php.ini display_errors and display_startup_errors set to 1, otherwise you cant see the error.

If there no error on log, there some possibility

kaizoku75 commented 3 years ago


Fatal error: Uncaught TypeError: explode() expects parameter 2 to be string, null given in proxydrive.php:115 Stack trace:

0 proxydrive.php(115): explode(',', NULL)

1 proxydrive.php(393): write_data('1CQMmVcDhpyPuGU...')

2 {main}

thrown in proxydrive.php on line 115

danipragustia commented 3 years ago

I dont have issue so far, and kinda weird if get_video_info return 200 OK if fmt_stream_map was null. You can tried this commit (https://github.com/danipragustia/php-videoproxy-gdrive/commit/f583022e1876022cb2fef3e561b6ca887c9b8622) and test, if this good or not.

My assumption is google drive file was not transcode yet, and this must be return 412 Failed create file, but on this case get_video_info tell file was rendered and doesnt return fmt_stream_map parameter on API.

kaizoku75 commented 3 years ago

mp4 file (f583022)

{"status":412,"error":"Failed write data."}

danipragustia commented 3 years ago

Can you provide the google drive in here, I cant find any issue so far (Tried before). If you did it kind help me to solve this problem.

kaizoku75 commented 3 years ago

https://pastebin.com/raw/WeprHRcP video file https://drive.google.com/file/d/0BwHxX3yoJoeuYzZlNm1jYVhwWWs/view php 7.2 {"status":412,"error":"Failed write data."} nothing in /_cache/ folder empty

danipragustia commented 3 years ago

image Its work using script on pastebin and your google drive file. Tried it on PHP 7.2.19 with Debian 10 Server. There possible permission issue on webroot, make sure apache/nginx have access of _cache folder with read and writeable flags.

I think error was on server-side and wasn't on the code, so I would close this issue. You can re-open the issue when you think it was mistake.