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

Internal server error: OCA\ServerInfo\OperatingSystems\shell_exec() #534

Closed
Valdnet opened this issue Nov 27, 2023 · 4 comments · Fixed by #598
Closed

Internal server error: OCA\ServerInfo\OperatingSystems\shell_exec() #534

Valdnet opened this issue Nov 27, 2023 · 4 comments · Fixed by #598
Assignees

Comments

@Valdnet
Copy link
Contributor

Valdnet commented Nov 27, 2023

Expected behaviour

Launching the serverinfo app.

Actual behaviour

An internal server error occurs while running server information.

Logs

[index] Error: Exception: Call to undefined function OCA\ServerInfo\OperatingSystems\shell_exec() in file '/home/xxx/public_html/cloud/apps/serverinfo/lib/OperatingSystems/DefaultOs.php' line 262 at <<closure>>

0. /home/xxx/public_html/cloud/lib/private/AppFramework/App.php line 183
   OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "index")
1. /home/xxx/public_html/cloud/lib/private/Route/Router.php line 315
   OC\AppFramework\App::main("OCA\\Settings\\ ... r", "index", ["OC\\AppFramewo ... "], ["serverinfo","s ... "])
2. /home/xxx/public_html/cloud/lib/base.php line 1068
   OC\Route\Router->match("/settings/admin/serverinfo")
3. /home/xxx/public_html/cloud/index.php line 36
   OC::handleRequest()

Caused by:

Error: Call to undefined function OCA\ServerInfo\OperatingSystems\shell_exec() at <<closure>>

 0. /home/xxx/public_html/cloud/apps/serverinfo/lib/OperatingSystems/DefaultOs.php line 197
    OCA\ServerInfo\OperatingSystems\DefaultOs->executeCommand("df -TPk")
 1. /home/xxx/public_html/cloud/apps/serverinfo/lib/Os.php line 78
    OCA\ServerInfo\OperatingSystems\DefaultOs->getDiskInfo()
 2. /home/xxx/public_html/cloud/apps/serverinfo/lib/Settings/AdminSettings.php line 79
    OCA\ServerInfo\Os->getDiskInfo()
 3. /home/xxx/public_html/cloud/apps/settings/lib/Controller/CommonSettingsTrait.php line 129
    OCA\ServerInfo\Settings\AdminSettings->getForm()
 4. /home/xxx/public_html/cloud/apps/settings/lib/Controller/AdminSettingsController.php line 83
    OCA\Settings\Controller\AdminSettingsController->formatSettings([[["OCA\\ServerI ... ]])
 5. /home/xxx/public_html/cloud/apps/settings/lib/Controller/CommonSettingsTrait.php line 149
    OCA\Settings\Controller\AdminSettingsController->getSettings("serverinfo")
 6. /home/xxx/public_html/cloud/apps/settings/lib/Controller/AdminSettingsController.php line 68
    OCA\Settings\Controller\AdminSettingsController->getIndexResponse("admin", "serverinfo")
 7. /home/xxx/public_html/cloud/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AdminSettingsController->index("serverinfo")
 8. /home/xxx/public_html/cloud/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Settings\ ... "], "index")
 9. /home/xxx/public_html/cloud/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Settings\ ... "], "index")
10. /home/xxx/public_html/cloud/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "index", ["OC\\AppFramewo ... "], ["serverinfo","s ... "])
11. /home/xxx/public_html/cloud/lib/base.php line 1068
    OC\Route\Router->match("/settings/admin/serverinfo")
12. /home/xxx/public_html/cloud/index.php line 36
    OC::handleRequest()

GET /index.php/settings/admin/serverinfo

Nextcloud version: 27.1.3

@kesselb
Copy link
Collaborator

kesselb commented Nov 28, 2023

Thanks for your report 👍

It seems that shell_exec is disabled on your end.

I thought this kind of error should be handled properly in executeCommand.
What php version are you using?

@Valdnet
Copy link
Contributor Author

Valdnet commented Nov 29, 2023

I'm using the PHP version: 7.4 and 8.1.

@Valdnet Valdnet added the bug label Nov 29, 2023
@kesselb
Copy link
Collaborator

kesselb commented Dec 28, 2023

Confirmed.

It's not possible to suppress an undefined function error since PHP 8 (https://php.watch/versions/8.0/fatal-error-suppression).

@arnaudjaegers
Copy link

Is it possible to detect if shell_exec() exists, and if not, show a proper information that this function should be enabled to use this app, instead of the default 500 error:

CleanShot_2024-01-26_at_14 50 18_Google Chrome_Nextcloud

End users will appreciate it.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants