我刚刚从Windows过渡到Ubuntu,并重新安装了Nginx,mysql,php7.0-fpm(包括Opcache / ApcCache),并从git克隆了一个项目(Yii2项目)。
该存储库可在Windows上运行,但现在似乎某些内置功能不再起作用。我检查了文档,似乎没有任何功能被弃用。
这是我到目前为止发现的错误,代码段及其相应的错误消息:
curl_init()
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->getSlackPayloadUrl());
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
调用未定义的函数backend \ components \ curl_init()
utf8_encode()
$data = 'payload=' . json_encode(array_map("utf8_encode", [
'channel' => $channel,
'text' => $message,
]));
array_map()期望参数1为有效的回调,找不到函数'utf8_encode'或无效的函数名称
为了更全面,nginx配置:
Nginx的配置
server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name project.dev;
root /var/www/project/backend/web;
index index.php;
access_log /var/www/project/log/access.log;
error_log /var/www/project/log/error.log;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}
如果还有其他相关信息,请添加评论,我会进行更新。
根据我们的讨论讨论,下面的解决方案是:
1.需要CURL
通过以下命令在您的系统上安装:-
sudo apt-get install php7.0-curl
2.关于第二个错误,我得到了这个链接:-utf8_(en | de)code已从php7中删除?
它指出utf8_encode/decode
与php xml extension
您必须通过以下命令安装系统的功能有关的功能:-
sudo apt-get install php7.0-xml
重要提示: -后安装这些库包的重新启动您的服务器,这样的变化将反映。谢谢。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句