Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
163 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
+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.
...