xhs@xhs:~$ sudo composer create-project symfony/website-skeleton symfony_web [sudo] password for xhs: Do not run Composer as root/super user! See https://getcomposer.org/root for details Installing symfony/website-skeleton (v4.1.6.3) - Installing symfony/website-skeleton (v4.1.6.3): Downloading (100%) Created project in symfony_web Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for symfony/framework-bundle v4.1.6 -> satisfiable by symfony/framework-bundle[v4.1.6]. - symfony/framework-bundle v4.1.6 requires ext-xml * -> the requested PHP extension xml is missing from your system. Problem 2 - Installation request for symfony/security-bundle v4.1.6 -> satisfiable by symfony/security-bundle[v4.1.6]. - symfony/security-bundle v4.1.6 requires ext-xml * -> the requested PHP extension xml is missing from your system. Problem 3 - Installation request for facebook/webdriver 1.6.0 -> satisfiable by facebook/webdriver[1.6.0]. - facebook/webdriver 1.6.0 requires ext-zip * -> the requested PHP extension zip is missing from your system. Problem 4 - Installation request for symfony/debug-bundle v4.1.6 -> satisfiable by symfony/debug-bundle[v4.1.6]. - symfony/debug-bundle v4.1.6 requires ext-xml * -> the requested PHP extension xml is missing from your system. Problem 5 - symfony/framework-bundle v4.1.6 requires ext-xml * -> the requested PHP extension xml is missing from your system. - symfony/maker-bundle v1.8.0 requires symfony/framework-bundle ^3.4|^4.0 -> satisfiable by symfony/framework-bundle[v4.1.6]. - Installation request for symfony/maker-bundle v1.8.0 -> satisfiable by symfony/maker-bundle[v1.8.0]. To enable extensions, verify that they are enabled in your .ini files: - /etc/php/7.3/cli/php.ini - /etc/php/7.3/cli/conf.d/10-mysqlnd.ini - /etc/php/7.3/cli/conf.d/10-opcache.ini - /etc/php/7.3/cli/conf.d/10-pdo.ini - /etc/php/7.3/cli/conf.d/20-calendar.ini - /etc/php/7.3/cli/conf.d/20-ctype.ini - /etc/php/7.3/cli/conf.d/20-curl.ini - /etc/php/7.3/cli/conf.d/20-exif.ini - /etc/php/7.3/cli/conf.d/20-fileinfo.ini - /etc/php/7.3/cli/conf.d/20-ftp.ini - /etc/php/7.3/cli/conf.d/20-gettext.ini - /etc/php/7.3/cli/conf.d/20-iconv.ini - /etc/php/7.3/cli/conf.d/20-json.ini - /etc/php/7.3/cli/conf.d/20-mbstring.ini - /etc/php/7.3/cli/conf.d/20-mysqli.ini - /etc/php/7.3/cli/conf.d/20-pdo_mysql.ini - /etc/php/7.3/cli/conf.d/20-phar.ini - /etc/php/7.3/cli/conf.d/20-posix.ini - /etc/php/7.3/cli/conf.d/20-readline.ini - /etc/php/7.3/cli/conf.d/20-shmop.ini - /etc/php/7.3/cli/conf.d/20-sockets.ini - /etc/php/7.3/cli/conf.d/20-sysvmsg.ini - /etc/php/7.3/cli/conf.d/20-sysvsem.ini - /etc/php/7.3/cli/conf.d/20-sysvshm.ini - /etc/php/7.3/cli/conf.d/20-tokenizer.ini You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode. xhs@xhs:~$ 想安装 zip扩展 sudo apt install php7.3-zip 报 The following packages have unmet dependencies: php7.3-zip : Depends: libzip4 (>= 1.0) but it is not installable E: Unable to correct problems, you have held broken packages. 那就先安装libzip4 sudo apt install libzip4 但sourcelist里没有 Reading package lists... Done Building dependency tree Reading state information... Done Package libzip4 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libzip4' has no installation candidate 没找到哪个源可以安装,就直接下载deb包安装了 http://security.ubuntu.com/ubuntu/pool/universe/libz/libzip/libzip4_1.1.2-1.1_amd64.deb 安装libzip4后就安装php7.3-zip 接着安装 php7.3-xml sudo apt install php7.3-xml ok 继续安装 symfony xhs@xhs:~$ sudo composer create-project symfony/website-skeleton /var/www/html/symfony_web 最后有一段,暂时不知道是什么意思 Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 1 !! !! In UnitOfWork.php line 2718: !! !! Warning: "continue" targeting switch is equivalent to "break". Did you mean !! to use "continue 2"? !! !! !! Script @auto-scripts was called via post-install-cmd 按官方的文档(可装可不装) https://symfony.com/doc/current/setup.html cd /var/wwwhtml/symfony_web/ sudo composer require symfony/web-server-bundle --dev 修改nginx配置 sudo /etc/nginx/conf.d/symfony.conf server { listen 80; listen [::]:80; server_name symfony.cc; root /var/www/html/symfony_web/public; index index.html index.htm index.nginx-debian.html index.php; server_name _; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; } } 检查语法后重启nginx sudo nginx -t sudo service nginx restart 访问http://192.168.3.187/ 出现symfony的页面