Laravel Homestead Mongo install causing PHP error undefined symbol: php_json_serializable_ce in Unknown on line 0

谁说胖子不能爱 提交于 2019-12-03 07:46:57

I think the problem is here that mongodb.so depends on json.so. The solution is to load mongodb.so after json.so.

I guess you are using the custom Mongo script for Homestead. The script outputs the mongodb.so module in php.ini file with the result that mongodb.so is loaded first. You should create a mongodb.ini file where mongodb.so is loaded.

Create the .ini-file: /etc/php/7.0/mods-available/mongodb.ini with content:

; configuration for php mongo module
; priority=30
extension=mongodb.so

Give it priority 30, since json gets 20 (in my settings) to be sure it is loaded afterwards.

Create a softlink of the ini-file to /etc/php/7.0/fpm/conf.d to make it available for the webserver.

ln -s /etc/php/7.0/mods-available/mongodb.ini 30-mongodb.ini

Reload webserver and php-fpm.

sudo service [your webserver] restart && sudo service php7.0-fpm restart

You are done! You can config the cli-version the same way

I had the same problem, I solved it by reverting to an older PECL mongodb version (1.1.9). There was an update to version 1.2.0 on November 29th, which is why the mongo-php-library also got updated to version 1.1.0.

Here is what I did:

sudo pecl uninstall mongodb
sudo pecl install mongodb-1.1.9
composer update

The pecl commands will show the same warning, but the installation was successfully completed.

I hope that the mongo-php-library will be fixed soon, so we're not stuck using an older PECL extension.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!