前言
运行命令 php artisan storage:link
报错提示信息:
ErrorException : symlink() has been disabled for security reasons
at /vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:252
248| */
249| public function link($target, $link)
250| {
251| if (! windows_os()) {
> 252| return symlink($target, $link);
253| }
254|
255| $mode = $this->isDirectory($target) ? 'J' : 'H';
256|
Exception trace:
1 symlink("/storage/app/public", "/public/storage")
/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:252
2 Illuminate\Filesystem\Filesystem::link("/storage/app/public", "/public/storage")
/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php:35
Please use the argument -v to see more details.
解决
去PHP安装目录找到php.ini,ctrl+F搜索“disable_functions”,找到如下属性配置:
disable_functions = scandir,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen
将“disable_functions”中的scandir、symlink删除,并保存php.ini文件,重启服务,刷新页面。
版权声明:本文为weixin_45593546原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。