Proc_open and Capifony issue

拟墨画扇 提交于 2020-01-25 23:45:57

问题


I'm trying to use Capifony with my web app in Symfony2.1 to accelerate the deployment process.

Here is my deploy.rb file :

default_run_options[:pty] = true
set :application, "mywebsite"
set :domain,      "mywebsite.com"
set :deploy_to,   "~/git/mywebsite.git"
set :app_path,    "app"

set :repository,  "git@github.com:myname/mywebsite.git"
set :scm,         :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`
set :user, "myserveruser"  # The server's user for deploys


set :model_manager, "doctrine"
# Or: `propel`

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 Symfony2 migrations will run

set :use_composer, true
set :update_vendors, true


set :use_sudo,      false
set :keep_releases,  3
set :shared_files,      ["app/config/parameters.yml"]
set :shared_children,   [app_path + "/logs", web_path + "/uploads"]

set :deploy_via, :rsync_with_remote_cache
set :ssh_options, { :forward_agent => true }
ssh_options[:keys] = %w(/.ssh/id_rsa)
ssh_options[:port] = xxxx


# Be more verbose by uncommenting the following line
logger.level = Logger::MAX_LEVEL

And here is my error :

 The Process class relies on proc_open, which is not available on your PHP installation.

when the script runs php composer.phar update

more details here : http://pastebin.com/hNJaMvwf

But I'm in a shared hosting and my hoster told me that I can't have proc_open enabled, is there a way to get it working though ?

Thanks a lot for your help !


回答1:


Composer needs to be able to run command-line processes (it does this using the symfony/process component). There is no way to have Composer run if your host does not support proc_open.

As an alternative deployment strategy, you could upload the vendor/ directory manually to the production machine (you can use the upload functionality in your Capistrano recipe). That said, virtual servers are affordable these days, and I would not recommend deploying Symfony2 applications to a shared hosting anyway. Maybe you should be looking for a different hosting solution?




回答2:


I also encountered a similar (but different) problem with my web host when using Composer to install the Sematic extension for my Mediawiki installation. I was not using Cafinony but using using Putty and SSH to run Composer on a "remote' command line. Composer failed with the same error;

The Process class relies on proc_open, which is not available on your PHP installation.

However, I was able to fix it another way.

proc_open is a PHP function that is typically "disabled' by most web hosts. It is disabled by including the function in the list of disabled functions which are set with the PHP configuration setting, disable_functions. In other words, if it is included in the list it is disabled; if it is removed from the list it is enabled.

You can therefore effectively enable proc_open "on the fly" by using the php command line -d option to remove the disabled functions (which includes proc_open). In other words, by removing the list of disable_functions you effectively "enable all" functions, including proc _pen.

To use -d to enable proc_open, you must set the disable_functions setting to an empty string. This will remove all the list of disabled functions (including proc_open)

When installing at the command line using an SSH client such as Putty, use a command similar to this:

php -f composer.phar -d detect_unicode=Off -d disable_functions= require mediawiki/semantic-media-wiki "1.9.*,>=1.9.0.1"

So, if you can figure out a way to pass "-d settings" with your ruby file, you may be able to solve your problem.

I know this does not fully address your problem, but it may help others with overcoming annoying default php settings on shared servers, that get in the way of Composer!

I hope this helps someone.



来源:https://stackoverflow.com/questions/15501606/proc-open-and-capifony-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!