开发者

Problem installing PEAR with a chef recipe for vagrant

开发者 https://www.devze.com 2023-03-06 02:16 出处:网络
I am using Vagrant to create a development server locally. I am writing my own Chef recipe to install everything I need but I am running into problems.

I am using Vagrant to create a development server locally. I am writing my own Chef recipe to install everything I need but I am running into problems.

Pear will not install as I think it is trying to pull down a version that is not stable. The error is:

No such file or directory - pear -d preferred_state=stable search PEAR

The recipe is as follows

# 
# Chef recipe for provisioning a LAMP
# development server.
#
require_recipe 'apt'
require_recipe 'apache2'
require_recipe 'apache2::mod_php5'
require_recipe 'php::module_开发者_Python百科gd'
require_recipe 'mysql::server'

php_pear "PEAR" do
    action :upgrade
end

php_pear "MDB2" do
    action :install
end

php_pear "MDB2#mysql" do
    action :install
end

# Grant access to this box...
ruby_block "Create database + execute grants" do
    block do

    require 'rubygems'
    Gem.clear_paths
    require 'mysql'

    m = Mysql.new('localhost', "root", node[:mysql][:server_root_password])
m.query("GRANT ALL ON *.* TO 'root'@'10.0.0.1' IDENTIFIED BY '#{node[:mysql][:server_root_password]}'")
m.query('FLUSH PRIVILEGES')

    end
end

How can I make PEAR install the last stable version?


You are using pear to install pear itself? Isn't that strange?

The error message

No such file or directory 

indicates that your recipe tries to use the full command as one executable, not as command and parameters.

pear -d preferred_state=stable search PEAR


Here's what I'm doing to upgrade PEAR in my Ubuntu VM:

package "php-pear" do
  action :install
end

There's an Ubuntu package called php-pear, so this command will install the latest version

0

精彩评论

暂无评论...
验证码 换一张
取 消