jordansissel/fpm · error · FPM::Util::ExecutableNotFound

pear

Error message

pear

What it means

The pear input type shells out to the PHP PEAR command-line tool; input() first asserts that 'pear' is on PATH and raises FPM::Util::ExecutableNotFound otherwise. The exception message is just the bare program name ('pear'), which can look cryptic in build logs.

Source

Thrown at lib/fpm/package/pear.rb:40

  option "--php-bin", "PHP_BIN",
    "Specify php executable path if differs from the os used for packaging"

  option "--php-dir", "PHP_DIR",
    "Specify php dir relative to prefix if differs from pear default (pear/php)"

  option "--data-dir", "DATA_DIR",
    "Specify php dir relative to prefix if differs from pear default (pear/data)"

  # Input a PEAR package.
  #
  # The parameter is a PHP PEAR package name.
  #
  # Attributes that affect behavior here:
  # * :prefix - changes the install root, default is /usr/share
  # * :pear_package_name_prefix - changes the
  def input(input_package)
    if !program_in_path?("pear")
      raise ExecutableNotFound.new("pear")
    end

    # Create a temporary config file
    logger.debug("Creating pear config file")
    config = File.expand_path(build_path("pear.config"))
    installroot = attributes[:prefix] || "/usr/share"
    safesystem("pear", "config-create", staging_path(installroot), config)

    if attributes[:pear_php_dir]
      logger.info("Setting php_dir", :php_dir => attributes[:pear_php_dir])
      safesystem("pear", "-c", config, "config-set", "php_dir", "#{staging_path(installroot)}/#{attributes[:pear_php_dir]}")
    end

    if attributes[:pear_data_dir]
      logger.info("Setting data_dir", :data_dir => attributes[:pear_data_dir])
      safesystem("pear", "-c", config, "config-set", "data_dir", "#{staging_path(installroot)}/#{attributes[:pear_data_dir]}")
    end

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Install the PEAR CLI: apt-get install php-pear (Debian/Ubuntu), dnf install php-pear (Fedora), apk add php8*-pear (Alpine)
  2. Verify with 'which pear' in the exact shell/environment fpm runs from
  3. If installed but not found, extend PATH or symlink pear into a standard bin directory

Example fix

# before
fpm -s pear -t deb HTTP_Request2   # => ExecutableNotFound: pear

# after
apt-get install -y php-pear && fpm -s pear -t deb HTTP_Request2
Defensive patterns

Strategy: validation

Validate before calling

require 'fpm/util'

abort 'pear CLI missing: install php-pear' unless FPM::Util.program_in_path?('pear')
system('fpm', '-s', 'pear', '-t', 'deb', 'HTTP_Request2')

Try / catch

begin
  pkg = FPM::Package::Pear.new
  pkg.input('HTTP_Request2')
rescue FPM::Util::ExecutableNotFound => e
  abort "required tool '#{e.message}' is not on PATH; install it first"
end

Prevention

When it happens

Trigger: Running 'fpm -s pear -t deb Some::Package' on a host without php-pear installed, or where pear exists but is not on PATH (restricted Docker images, cron/systemd jobs with a minimal PATH).

Common situations: Minimal CI containers without the PHP toolchain; local pear installs under /usr/local/bin not on the service user's PATH; build agents provisioned only for rpm/deb packaging.

Related errors


AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21). Data as JSON: /api/errors/f63ac18c9f0a0ba9. Report an issue: GitHub.