【发布时间】:2021-05-11 23:53:33
【问题描述】:
伙计们,我在部署 Symfony 项目时遇到了一些麻烦:
我运行命令:
composer install --no-dev --optimize-autoloader
我使用了 apache-pack:
composer require symfony/apache-pack
这在公用文件夹中创建了一个带有 index.php 的 .htaccess。
-找不到资产。 (公用文件夹内的元素):
GET http://buy-m3.infinityfreeapp.com/css/custom.css
net::ERR_ABORTED 404 (Not Found)
-数据库连接问题:
Request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException:
"An exception occurred in driver: SQLSTATE[HY000] [2002] N
o such file or directory" at /home/vol6_3/epizy.com/epighhg78813/htdocs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
line 112 {"exception":"[object] (Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002]
No such file or directory at /home/vol6_3/epizy.com/epghghgh878813/htdocs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:112)\n
[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 2002): SQLSTATE[HY000] [2002]
No such file or directory at /home/vol6_3/epizy.com/epihghgh13/htdocs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18)
\n[previous exception] [object] (PDOException(code: 2002):
SQLSTATE[HY000] [2002] No such file or directory at /home/vol6_3/epizy.com/epighgh8813/htdocs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:38)"} []
- 转储环境产品:
// This file was generated by running "composer dump-env prod"
return array (
'APP_ENV' => 'prod',
'APP_SECRET' => 'c84117fa77c8ghgghghhgds03',
'DATABASE_URL' => 'mysql:user:password@shost/dnbame',
);
我也在应用程序根目录添加了一个 htacces:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [QSA,L]
</IfModule>
有人可以帮忙吗?谢谢
【问题讨论】:
标签: php apache symfony deployment doctrine-orm