I've just made the transition to Ubuntu from Windows, and I've set up a fresh install of nginx, mysql, php7.0-fpm (including the Opcache/ApcCache) and cloned a project from git (Yii2 project).
This repository worked on windows, but it now seems some of the built-in functions are no longer working. I've checked the docs, and it does not seem like any of the functions are deprecated.
This is the errors i've found so far, code-snippets and their corresponding error messages:
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);
Call to undefined function backend\components\curl_init()
utf8_encode()
$data = 'payload=' . json_encode(array_map("utf8_encode", [
'channel' => $channel,
'text' => $message,
]));
array_map() expects parameter 1 to be a valid callback, function 'utf8_encode' not found or invalid function name
And for thoroughness, the nginx config:
nginx config
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;
}
}
If there is any other information that is relevant, add a comment and I'll update.