Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
945 views
in Q2A Core by
I made a site by questions2answer.

But, when I try to add new category as superadmin, I receive HTTP ERROR 500.

I try all alternatives but I can't solve this problem.

What should I do?

thanks in advance.
Q2A version: Version 1.8.6
by
Check your webserver logs. They should provide more information about what's causing this error.
by
Error logs are:

crbug/1173575, non-JS module files deprecated. (index):7146.
No resource with given URL found.
by
Error logs:

crbug/1173575, non-JS module files deprecated. (index):7146.
No resource with given URL found...
by
+1
AFAICS crbug/1173575 refers to a Chromium browser issue (https://bugs.chromium.org/p/chromium/issues/detail?id=1173575), which is unlikely to have any relation to the problem in your question.
Also, I was asking you to check your *webserver logs*, not your browser web console. If you don't understand what I'm asking you to do you may want to hire someone who has at least basic knowledge of operating a webserver.
by
edited by
IIRC this can happen if you have done wrong or incompatible URL in Admin/General. For example .htaccess not being enabled in webserver but trying to use fancy URL.
by
+1
Thanks for your time.

I talked to the hosting company about the issue. They said that there is no error log record caused by the web server.
by
+2
5xx errors are server-side errors (i.e. errors in the web application or -less frequently- in the webserver configuration). If your web hosting company can't find an error 500 in their logs I can see only 2 possibilities: a) they're incompetent and botched their logging, in which case you want to find a different hosting provider, or b) they're lying to you, in which case you want to find a different hosting provider.
by
+1
Thanks for your time.

I asked hosting company again and they said that Error logs are in public_html direcctory and in error_log file.

I see that error log below in this file. What should I do?

[14-Jun-2021 13:13:30 UTC] PHP Fatal error:  Uncaught ValueError: max(): Argument #1 ($value) must contain at least one element in /home/qqrdty0qbiuv/public_html/qa-include/pages/admin/admin-categories.php:483
Stack trace:
#0 /home/qqrdty0qbiuv/public_html/qa-include/pages/admin/admin-categories.php(483): max()
#1 /home/qqrdty0qbiuv/public_html/qa-include/app/page.php(183): require('/home/qqrdty0qb...')
#2 /home/qqrdty0qbiuv/public_html/qa-include/qa-page.php(47): qa_get_request_content()
#3 /home/qqrdty0qbiuv/public_html/qa-include/qa-index.php(188): require('/home/qqrdty0qb...')
#4 /home/qqrdty0qbiuv/public_html/index.php(27): require('/home/qqrdty0qb...')
#5 {main}
  thrown in /home/qqrdty0qbiuv/public_html/qa-include/pages/admin/admin-categories.php on line 483
by
+1
According to that log excerpt the error is caused by this expression: @max(array_keys($positionoptions))
Apparently array_keys() does not return any keys from the array $positionoptions. Check the value of that variable, and if it's empty, check why it's not being populated by the foreach loop a couple lines above.
If you don't have a debugger you can use the approach I described here: https://systemrequest.net/index.php/23#a24

1 Answer

+1 vote
by
It's most likely compatibility issues.  Make sure your host environment meets Q2A's requirements. Check your PHP version, MySQL version, etc.. You may have passed some initial installation, setups, and usage, but in between something will break.

For example, when I was installing mine I had it at PHP 8, received some errors during setup, and I had to dial mine down to 7.4. Everything was golden for me after that.
...