Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues on shared hosting with PHP version above 5.4 #13002

Closed
kwazaro opened this issue May 5, 2016 · 28 comments
Closed

Issues on shared hosting with PHP version above 5.4 #13002

kwazaro opened this issue May 5, 2016 · 28 comments
Labels
area-core bug The issue in the code or project, which should be addressed.
Milestone

Comments

@kwazaro
Copy link

kwazaro commented May 5, 2016

Summary

On the shared hosting ukraine.com.ua when I change the PHP version from 5.4 to 5.5, 5.6 or 7.0 there are some strange bugs in Manager, On the frontend all seems to work fine, The settings and hosting PHP configs satisfies MODx requirements and they are not changing during PHP version switching. Hosting support couldn't help.

Step to reproduce

On the shared hosting panel in Ukraine.com.ua change PHP version from 5.4 to 5.5, 5.6 or 7. This issues present on existing sites and on fresh install (installation goes with no problems). Modx Revo v2.5.0.

Observed behavior

the package manager not working correctly (showing LOADING... but can't load any package list from repo). Also, there is no image thumbnails in Media Manager or in Resource Edit Page (with image TV). In REPORTS -> SYSTEM INFORMATION menu item in Manager not showing some data (the Modx version, version codename, local and server time, database type, db version, db encoding etc.). On PHP 5.4 this information showing correctly)

Expected behavior

There is no issues on the same hosting with PHP 5.4.

Environment

I can attach file with comparison of two phpinfo() outputs: first is from working MODx website with PHP 5.4 and the second - the same system, but with PHP 7 (with issues), maybe it can help to find differrence between settings.
compare-phpinfo.zip

@OptimusCrime
Copy link
Contributor

Sounds like a problem with the server configuration or something. Looking at the diff, the PHP configurations looks correct.

Do you have anything in your error logs? From the web server or MODX's.

@kwazaro
Copy link
Author

kwazaro commented May 5, 2016

In the package manager page firebug shows error in ext-all.js:
SyntaxError: expected expression, got '}' ({"success":true,"total":"668","results":})
When I click in the left tree to Extras -> Administration, or something else - the error occurs:
SyntaxError: expected expression, got '}' ({"success":true,"total":"133","results":})
Also in SYSTEM INFO page in Manager I can see error in firebug:
SyntaxError: expected expression, got '}' ({"success":true,"total":"5","results":})
The error log in MODX is clean. The server error log also blank. In access log there is nothing unusual. I don't know what can it be...

@OptimusCrime
Copy link
Contributor

The JSON is invalid. You can see that the string that should be the value of "results" is empty. This is most likely because you have invalid characters in your data. I see in your config you have russian language. The issue may be caused by something like this: http://stackoverflow.com/questions/10205722/json-encode-invalid-utf-8-sequence-in-argument

What charset does you mysql database have?

@kwazaro
Copy link
Author

kwazaro commented May 5, 2016

Russian language. Charset is utf-8 (in mysql - utf8_general_ci). I have no problems with charsets on website or server, as I always use Unicode.

@DFSko
Copy link

DFSko commented May 11, 2016

apache 2.4? invalid json on this version

@kwazaro
Copy link
Author

kwazaro commented May 11, 2016

Is this a MODX bug? Because other CMS works fine with this version of Apache. How can I solve it?

@Mark-H
Copy link
Collaborator

Mark-H commented May 24, 2016

I don't know if it's a MODX bug. If it is, it's definitely specific to something in your environment (and perhaps the environment in #13011 - anything in common between those reports perhaps?), as I can access the packages just fine running PHP 5.4, 5.6 and 7.0.

@Jako
Copy link
Collaborator

Jako commented May 25, 2016

As @OptimusCrime already said: There must be an issue with your charset (MODX charset, database charset, database table charset or database field charset) because the value of results is empty in your JSON. You have to debug which data causes this on your installation. It is almost impossible to detect this from outside.

@kwazaro
Copy link
Author

kwazaro commented May 25, 2016

Everything semms to be fine with charsets, UTF-8 is set everywhere (actually, charset not changing while switching PHP version from 5.4 to 5.5 or higher).

@jdaehne
Copy link
Contributor

jdaehne commented May 26, 2016

I had the same issue.
In System-Settings i had "locale" set to "de_DE". That caused the error. After removing this entry or changing it to "en_EN" the error dissapeared and the PM was working fine again.

@Jako
Copy link
Collaborator

Jako commented May 26, 2016

Interesting, could you try it with de_DE.utf8? This should set the right charset for the locale.

@kwazaro
Copy link
Author

kwazaro commented May 26, 2016

Thanks to @jdaehne and @Jako - setting the locale parameter in System settings solved problem with Package Manager and Logs->System information. Right setting for my case was "ru_RU.utf8". It works now for PHP 7.0 (I had empty "locale" parameter in system settings and it didn't cause any issues in PHP 5.4). But the thumbnails in Media Manager still not showing... Even after full cache clearing and sessions reset.

@jdaehne
Copy link
Contributor

jdaehne commented May 26, 2016

Nice! Setting locale to de_DE.utf8 solved the problem. Thanx Jako.

@Jako
Copy link
Collaborator

Jako commented May 26, 2016

@kwazaro There is at least one PHP7 issue left in MODX phpThumb, that could cause missing thumbnails in the manager. This could be temporarily solved by changing the phpThumb constructor in https://github.com/modxcms/revolution/blob/2.x/core/model/phpthumb/phpthumb.class.php#L218 from phpThumb to __construct. There will be a better fix for this in 2.5.1 or 2.5.2

@Jako
Copy link
Collaborator

Jako commented May 26, 2016

Using the right locale setting should be mentioned in the RTFM.

@kwazaro
Copy link
Author

kwazaro commented May 26, 2016

@Jako thanks for help! Changing the constructor function name "phpThumb()" to "__construct()" in phpthumb.class.php in line 218 helped. Thumbnails are showing now. I hope this will be fixed on next version of MODx.

@kwazaro kwazaro closed this as completed May 26, 2016
@Jako
Copy link
Collaborator

Jako commented May 30, 2016

The phpThumb class is updated with this PR: #13039

It would be nice if you could check this out and tell us your efforts, please.

@Jako
Copy link
Collaborator

Jako commented May 30, 2016

@kwazaro Are you sure that the MODX system setting locale was empty, when the issues occured? Or did you use a non UTF-8 locale like ru_RU?

@kwazaro
Copy link
Author

kwazaro commented May 30, 2016

I have some differrent sites with modx, and all of them have system setting "locale" empty (by default, I didn't change it after fresh installation). This is OK on PHP 5.4, but on PHP version above 5.4 caused problems. Issues gone when a set this setting to "ru_RU.utf8" on site with PHP7. I have checked #13039 - seems to work without issues.

@Jako
Copy link
Collaborator

Jako commented May 30, 2016

Does the system work with PHP7 if you use en as manager_language?

@kwazaro
Copy link
Author

kwazaro commented May 30, 2016

If I use "en" as manager language - system works fine on PHP7, BUT only if "locale" parameter is set (like "en_GB.utf8"). If i leave locale parameter empty - issues comes back (package manager doesn't work, empty values in reports etc.).

@Jako
Copy link
Collaborator

Jako commented May 30, 2016

Ok, thanks for the info. Could you look into a PHP7 MODX installation and see what is the output for [[++locale]] in the frontend with an empty locale system setting? Maybe there is a not utf8 capable default value for this in php.ini.

@kwazaro
Copy link
Author

kwazaro commented May 30, 2016

If "locale" setting is empty, the output of [[++locale]] is empty too.

@Jako Jako reopened this May 30, 2016
@Jako Jako added bug The issue in the code or project, which should be addressed. area-core priority-2-high labels May 30, 2016
@Jako Jako added this to the v2.5.1-pl milestone May 30, 2016
@Jako
Copy link
Collaborator

Jako commented May 30, 2016

So maybe the locale system setting has to be filled with en_EN during an installation/update if it is empty to avoid possible manager issues with PHP7. And the description of that setting should contain that the locale has to contain utf8 chars. Otherwise the Package Manager and some other parts of the manager are broken.

@kwazaro
Copy link
Author

kwazaro commented May 30, 2016

It is good idea to fill this setting by default during installation or update to locale, which depends on selected language during install/update, for example, "en_GB.utf8" for English, or "ru_RU.utf8" for Russian.

@Mark-H
Copy link
Collaborator

Mark-H commented May 30, 2016

Shouldn't this just be configured properly on the server by default? The way I see the locale setting, it is a way to override the default but for the vast majority the server configuration should be just fine?

@OptimusCrime
Copy link
Contributor

Depends on how your system is defined? I can easily install/remove locales on my server. There is no guarantee that those locales are available as far as I know. I do not have "ru_RU.utf8" installed on my servers.

@Jako
Copy link
Collaborator

Jako commented Jul 21, 2016

The phpThumb version is upgraded and the PHP7 issue is solved there. Only the locale setting could cause PHP7 issues then. I have opened another Issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

No branches or pull requests

6 participants