我正在我的服务器上进行首次部署,但是我对permisions有问题。
我正在使用jenkins进行部署我的构建步骤如下所示:
echo '
parameters:
database_driver: pdo_mysql
database_host: %database.host%
database_port: null
database_name: symfonyapp
database_user: %database.user%
database_password: %database.password%
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: cs
secret: 08b6b8f6548a96bd1ff1533ec02e39ae
'> app/config/parameters.yml
export SYMFONY__DATABASE__USER=user
export SYMFONY__DATABASE__HOST=localhost
export SYMFONY__DATABASE__PASSWORD=secret
composer.phar install --optimize-autoloader
php app/console cache:clear --env=prod --no-debug
php app/console assetic:dump --env=prod --no-debug
touch app/logs/prod.log
chmod -R 777 app/cache
chmod -R 777 app/logs
但我收到此错误并且不知道为什么因为我设置了所有内容,文件夹日志和缓存也是可写的
[Fri Sep 06 12:09:24 2013] [error] [client 217.112.169.14] PHP Warning: mkdir(): Permission denied in /projectPath/app/cache/prod/classes.php on line 315
[Fri Sep 06 12:09:24 2013] [error] [client 217.112.169.14] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/anotherPath/app/logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /projectPath/app/cache/prod/classes.php:4787\nStack trace:\n
#0 /projectPath/app/cache/prod/classes.php(4735): Monolog\\Handler\\StreamHandler->write(Array)\n
#1 /projectPath/app/cache/prod/classes.php(4664): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n
#2 /projectPath/app/cache/prod/classes.php(4850): Monolog\\Handler\\AbstractHandler->handleBatch(Array)\n
#3 /projectPath/app/cache/prod/classes.php(5066): Monolog\\Handler\\FingersCrossedHandler->handle(Array)\n
#4 /projectPath/app/cache/prod/classes.php(5166): Monolog\\Logger->addRecord(500, 'Uncaught PHP Ex...', Array)\n
#5 /projectPath/app/cache/prod/classes.php on line 4787
答案 0 :(得分:1)
跟踪中的第二行告诉你出了什么问题。
[Fri Sep 06 12:09:24 2013] [error] [client 217.112.169.14] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/anotherPath/app/logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /projectPath/app/cache/prod/classes.php:4787\nStack trace:\n
对于詹金斯来说,使用phing或蚂蚁要好得多。查看http://jenkins-php.org/以获得方便的设置。
就像一个想法。我猜你的bash脚本没有在正确的工作目录中执行。您只需ls -lah app/logs/prod.log
如果你有调用缓存的服务器以外的路径:clear,那么你将在cache / prod / classes.php中有错误的路径。您需要为使用rsync的所有服务器创建相同的路径。