0

I want to install PHP PEAR on Windows non-interactively.

If I just download http://pear.php.net/install-pear-nozlib.phar and run it like this:

php install-pear-nozlib.phar

It gets installed into C:\php.

But my PHP is installed into C:\PHP5 (and it is in the %PATH%).

So I want to somehow install PEAR into C:\PHP5, but can't find a way to do it.

What way of installing PEAR do you recommend in my situation?

vadipp
  • 449
  • 2
  • 4
  • 12

1 Answers1

1

I was able to achieve my goal by automating the interactive PEAR installer using the expect port for Windows.

Here is the install_pear.tcl script I created:

package require Expect

spawn php "go-pear.phar"

expect "system\|local" {
    exp_send "system\r\n"
}

expect "Enter to continue" {
    exp_send "\r\n"
}

expect "Would you like to alter php.ini" {
    #exp_send "y\r\n"
}

#interact

The commented-out lines might be required, depending on how you run the script.

The script needs to be run from the required target directory, in my case it's the PHP root directory, C:\PHP5:

cd C:\PHP5
tclsh install_pear.tcl

You may also want to look at the ActiveTCL unattended installation.

vadipp
  • 449
  • 2
  • 4
  • 12