Page 1 of 1

PEAR Install Problem

Posted: Mon Aug 22, 2005 7:12 pm
by michaelbell
I have just installed PHP5 on an XP Pro box.
PHP is installed and I am able to use the phpinfo(); to view its config and packages installed.

I also went through the process of installing PEAR. Double clicked go-pear.bat and walked through the process.
I did not define a website as I am running Apache and using localhost. After the install finished I double clicked the PEAR_ENV.reg and updated the registry as explained.

At this point I should be able to type, pear at the command prompt and pear should respond.

But, it does not. Instead I get, "'pear' is not recognized as an internal or external command, operable program or batch file.

I have tried over and over again and I'm loosing more and more hair.

Thanks in advance to all,
Mike

Posted: Mon Aug 22, 2005 8:13 pm
by Ambush Commander
Easy: add the PHP directory to your Path environment variable.

What does Path do? Path determines which directories Windows will look in when you type in a command like "php" or "pear".

This can be accessed via My Computer > Properties > Advanced > Environment Variables

And then you can edit the User variable Path just to affect your user, or you edit the System Variable Path. Semicolons seperate different paths. I'm not sure which way precedence goes, but generally it shouldn't be a problem.

Another way to do it is to place another file called pear.bat in your C:\WINDOWS\system32\ folder (which is, by default, in your Path variable) and put this in it:

Code: Select all

@echo off
"C:/Program Files/PHP/pear.bat" %*
Which allows you to access pear.bat without muddying up your Path variable (that can be a big problem sometimes). Of course, replace "C:/Program Files/PHP/pear.bat" with the actual location of your pear.bat file.

Personally, I prefer this method, and I have my own folder that was put in Path where I put all my batch files like this. This is especially useful when I use PHP for command line development.

Hope that helps!

Posted: Mon Aug 22, 2005 8:25 pm
by michaelbell
Dude! You rock!
Worked perfect. I added the pear.bat file like you suggested and bada boom bada bing, pear works.
I just with that the instructions for this was on the PEAR site.

Thanks,
Mike