Loading...
 
Architecture / Installation

Architecture / Installation


File upload fails with php 7.0+

posts: 210 Ukraine

I have a number of Tiki installations in one shared hosting account and I would like to update one test site to Tiki 20x, yet cannot because that means having to update my php version higher than 5.6 - and one site needs to say on Tiki 15x (or update all the sites to 20x, which I'm not ready to, several critical ones need to stay on 18x).

Though every time I have tested to change php to 7.0 or higher (tried them all. 7.0, 7.1, 7.2, 7.3, 7.4) uploading to File Galleries always fails (regardless of type of file). Since I know uploading to 18x and 20x work with Tiki in php 5.6 and 7.0+, this is obviously my settings somewhere. Files are all stored to Database as this is shared hosting.

I may have missed something in Control Panels > File Galleries, but think it is more to do with enabling a php setting in the PHP Selector in cPanel. Can anyone help by letting me know if I need to enable any of these settings?

Php Options1

Php Options 2

Php Options 3

Or, if I missed something somewhere else.

Thanks, and, Happy New Year!

br,
Mike

posts: 210 Ukraine

Hi,

I just upgraded several Tiki installations to the latest 18.6 (via Softaculous) than changed PHP to v. 7.3 and I still get this error -

"File Upload Failed:
Syntax Error:
Unexpected end of
JSON input"

I tested uploading to File Galleries with both a simple .jpg and .xls, but I get the same red error message. Keep in mind, this is shared hosting.

I would like to update to Tik 21x but am pretty worried that uploading to File Galleries will not work.

Does anyone know what this error message means, and, what can be done about it?

thanks
Mike

posts: 210 Ukraine

actually, I'm getting two similar but slightly different error messages when uploading to File Galleries on the two different Tiki installations (both on 18.6 now). The message above and:

"File upload failed:
SyntaxError:
Unexpected token <
in JSON at position 0"

br,
Mike


posts: 8458 Israel

Hello Mike,

Sorry for a reply not very useful (got my support ! ;-) ).
I had issues with 20.x and image uploading but didn’t really investigate as I moved to 21.x a few days later (and 20.x is done for me).

May be you should try to jump... ?

I would stick with php7.2 (look to me more tested than the others).

Do you use elfinder ?
If yes try without elfinder just to check.

Also CRSF errors were getting in the way when I had issues (20.x) I think disabled in the Admin => Security to test.

Good luck

posts: 210 Ukraine

Hi Bernard,

Some helpful advice that I overlooked, unfortunately, I tried them all and no change, still file upload errors.

As you suggested, I re-tested using php 7.2.
I believe I tried elFinder a when the problem first surfaced, but re-tested anyways - no difference.

The suggestion I though surely would work, disabling CSRF, but also, no changes, still errors.

Unfortunately, I cannot risk moving to Tiki 21x until this issue is solved, as it does not work with php 5.6 (Tiki without a working File Galleries would be a severely wounded duck).

In any case, thanks very much for trying to help.

br,
Mike


posts: 210 Ukraine

PROBLEM SOLVED!!!!!!!!!!!!!!!!!

I found this post on the 'Dev' site, looks like I'm not the only one having these issues
https://dev.tiki.org/item6600-File-Galleries-File-upload-failed-SyntaxError-Unexpected-token-in-JSON-at-position-0

I suspected it was just some php configuration I did not have enabled, and it turns out I needed to enable the 'fileinfo' extension. Once enabled, file uploading works with php versions higher than 5.6 (I'm currently using php 7.3).

Issue closed :-)