安装laravel 11与宝塔环境中php的默认禁用函数的冲突问题

1.安装Laravel安装器

composer global require laravel/installer

报错1:

E:\wwwroot>composer global require laravel/installer

Fatal error: Uncaught Error: Call to undefined function Composer\XdebugHandler\putenv() in phar://E:/composer/composer.phar/vendor/composer/xdebug-handler/src/Process.php:98
Stack trace:
#0 phar://E:/composer/composer.phar/vendor/composer/xdebug-handler/src/Status.php(59): Composer\XdebugHandler\Process::setEnv('XDEBUG_HANDLER_...')
#1 phar://E:/composer/composer.phar/vendor/composer/xdebug-handler/src/XdebugHandler.php(101): Composer\XdebugHandler\Status->__construct('COMPOSER_ALLOW_...', false)
#2 phar://E:/composer/composer.phar/bin/composer(28): Composer\XdebugHandler\XdebugHandler->__construct('Composer')
#3 E:\composer\composer.phar(29): require('phar://E:/compo...')
#4 {main}
  thrown in phar://E:/composer/composer.phar/vendor/composer/xdebug-handler/src/Process.php on line 98

删除宝塔相应php版本的禁用函数:putenv 重试

报错2

再删除宝塔相应php版本的禁用函数:proc_open 重试

报错3

Fatal error: Uncaught Error: Call to undefined function Symfony\Component\Process\proc_get_status() in phar://E:/composer/composer.phar/vendor/symfony/process/Process.php:1346
Stack trace:
#0 phar://E:/composer/composer.phar/vendor/symfony/process/Process.php(368): Symfony\Component\Process\Process->updateStatus(false)
#1 phar://E:/composer/composer.phar/vendor/symfony/process/Process.php(253): Symfony\Component\Process\Process->start(Object(Closure), Array)
#2 phar://E:/composer/composer.phar/src/Composer/Util/ProcessExecutor.php(167): Symfony\Component\Process\Process->run(Object(Closure))

可以看到 proc_get_status 未定义,再删除宝塔相应php版本的禁用函数:proc_get_status 重试

ok,laravel 安装器已经装好了,开始创建要一个项目

2.安装Laravel安装器

laravel new ESLS

后面根据自己的需要去选择,

报错4:最后还有会有一个创建软连接的错误。


   Error

  Call to undefined function Illuminate\Filesystem\exec()

  at vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:360
    356▕         }
    357▕
    358▕         $mode = $this->isDirectory($target) ? 'J' : 'H';
    359▕
  ➜ 360▕         exec("mklink /{$mode} ".escapeshellarg($link).' '.escapeshellarg($target));
    361▕     }
    362▕
    363▕     /**
    364▕      * Create a relative symlink to the target file or directory.

补充, laravel 11遇到的错误

  [Error]
  Call to undefined function Symfony\Component\Console\Helper\shell_exec()

因此还需要解除禁止:shell_exec 函数

总结

使用宝塔环境,不要禁用php的“ putenv 、proc_open、proc_get_status、shell_exec 和 exec ”这些函数。

posted @ 2024-12-12 23:43  天行侠  阅读(23)  评论(0编辑  收藏  举报