我正在尝试首次将我的应用程序部署到生产环境中。为此我想要Capifony。我遵循了Capifony.org的说明,但我坚持这个错误
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php on line 35
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in app/console on line 13
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in app/console on line 13
我的托管服务提供商默认提供PHP 5.2,但我可以访问5.3所以我需要在Capifony配置上设置php路径。
这是我的deploy.rb
#Application
set :application, "acme"
set :domain, "#{application}.com"
set :deploy_to, "/home/user/public_html/acme"
set :app_path, "app"
#Repository
set :repository, "git@bitbucket.org:user/repo.git"
set :scm, :git
set :deploy_via, :rsync_with_remote_cache
set :git_enable_submodules, 1
set :model_manager, "doctrine"
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
set :keep_releases, 3
#Symfony2
set :shared_files, ["app/config/parameters.ini"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :update_vendors, true
set :dump_assetic_assets, true
#Server connection
set :user, "user"
ssh_options[:forward_agent] = true
ssh_options[:port] = "2222"
set :use_sudo, false
set :php_bin, "/opt/php53/bin/php"
最后在我的开发环境中,我从未遇到过这些错误。
编辑: 抛出错误时由capifony执行的命令
/opt/php53/bin/php bin/vendors install --reinstall
Symfony -> 2.0.12
Capifony -> 2.1.5
Capistrano -> 2.11.2
控制台第13行:使用Symfony \ Bundle \ FrameworkBundle \ Console \ Application;
答案 0 :(得分:0)
作为一种解决方法,在PATH开头添加PHP 5.3路径可以解决此问题。