且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel Homestead Mongo安装导致PHP错误未定义符号:第0行中的Unknown中的php_json_serializable_ce

更新时间:2023-02-24 07:56:11

我认为问题出在这里,mongodb.so依赖于json.so.解决方案是在json.so之后加载mongodb.so.

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

我想您正在为Homestead使用自定义Mongo脚本.该脚本在php.ini文件中输出mongodb.so模块,其结果是首先加载mongodb.so. 您应该创建一个mongodb.ini文件,在该文件中装入mongodb.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.

创建.ini文件:/etc/php/7.0/mods-available/mongodb.ini,内容:

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

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

给它优先级30,因为json得到20(在我的设置中)以确保之后加载.

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

创建一个ini文件到/etc/php/7.0/fpm/conf.d的软链接,以使其可用于网络服务器.

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

重新加载Web服务器和php-fpm.

Reload webserver and php-fpm.

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

您完成了!您可以用相同的方式配置cli-version

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