PHP - FFI Cannot Allocate Callback Error


When running on a Linux environent using SELinux, an error similar to the following may be encountered. This would be raised while trying to create an instance of one of the PHP components:

PHP Fatal error: Uncaught FFI\Exception: Cannot allocate callback in include/ipworks_http.php

This can be caused by some of the SELinux settings, and the following commands should help to resolve the issue:

sudo setsebool -P httpd_execmem on // allows Apache (and php-fpm) to execute code in memory sudo setsebool -P httpd_tmp_exec on // allows Apache (and php-fpm) to execute files in /tmp sudo systemctl restart php-fpm // restarts php-fpm so the changes take effect

If these settings cannot be used in your environemnt due to other security concerns, please connect with our support team so we can help with alternative options.

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.