Jump to content

Installing Pear


skaterdav85

Recommended Posts

I'm trying to install PEAR so that I can use the build tool Phing and I can't get the 'pear' command to work. Has anyone done this before? I went to this link to install PEAR on Mac. I installed wget fine and ran the first line:

$ wget http://pear.php.net/go-pear.phar$ php -d detect_unicode=0 go-pear.phar

Then, I ran the second line in the terminal, and it seems PEAR installed fine. However, if I just type in pear, it says 'command not found'. Anyone have any idea on installing PEAR?

Link to comment
Share on other sites

It says you should run it in superuser mode — try that. P.S.: the wget utility just downloads the file at the URL provided in the argument.

Link to comment
Share on other sites

It's the sudo bit that comes before the second command in their documentation (in the yellow box) — it means to run the command with elevated privileges (i.e. as root, or "Administrator" as they call it in Windows).

Link to comment
Share on other sites

i just tried it in superuser mode and it still doesnt recognize the command. basically I typed in sudo su, entered my password, and then ran: sudo php -d detect_unicode=0 go-pear.pharAfter typing that, I get this: Below is a suggested file layout for your new PEAR installation. Tochange individual locations, type the number in front of thedirectory. Type 'all' to change all of them or simply press Enter toaccept these locations. 1. Installation base ($prefix) : /var/root/pear 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /var/root/pear/bin 5. PHP code directory ($php_dir) : /var/root/pear/share/pear 6. Documentation directory : /var/root/pear/docs 7. Data directory : /var/root/pear/data 8. User-modifiable configuration files directory : /var/root/pear/cfg 9. Public Web Files directory : /var/root/pear/www10. Tests directory : /var/root/pear/tests11. Name of configuration file : /var/root/.pearrc 1-11, 'all' or Enter to continue: I pressed Enter. I see a pear directory but when i type in pear in Terminal, it still doesnt recognize the command. Any ideas?

Link to comment
Share on other sites

Well it looks like is has installed the pear binary to /var/root/pear/bin (check though, I don't know), which is probably not on the PATH environment variable (which lists the location where the OS should search for binaries by default). You can either change your .bashrc or similar to include that path in the PATH environment variable, or press '4' during installation to change the path to something already used (/bin or /usr/bin would be appropriate). Or you can just type in /var/root/pear/bin/pear every time you want to run it.

Link to comment
Share on other sites

.bashrc is in your home folder (it is hidden, due to the . at the start). To append the pear path to the PATH variable you can add the line:

export PATH=$PATH:/var/root/pear/bin

You may have to restart terminal / re-login for it to take effect (the .bashrc file is basically a list of commands that is run by bash, the shell, when it runs).

Link to comment
Share on other sites

thanks Installing Phing has been a huge pain. I found it painful to just install Pear, but once I did that thanks to your help, now it doesn't recognize the Phing command. It seems like using YUI Compressor to compress CSS and JS, and then manually concatenating files might be easier. Do you have a build process in place?

Link to comment
Share on other sites

Installing Phing has been a huge pain.
????I can almost understand installing PEAR to be a pain, but after you've done that, installing Phing should be just a matter of executing these commands in order:
pear channel-discover pear.phing.infopear install phing/phing

or have you been trying a non-PEAR install simultaneously with your attempts at a PEAR install (I can understand how you could mess up one with the other)?

Do you have a build process in place?
No, because the stuff I do doesn't really need it (i.e. my build process consists of a step or two which I don't find a problem in doing manually), but come to think of it, I might start entertaining the idea.
Link to comment
Share on other sites

Well I installed PEAR fine and after running those commands, it says I installed Phing. However, if I type in phing -v, it says 'command not found'. I browsed around on Google and I think it has to do with some path issue, but I'm not sure how to fix it.

Link to comment
Share on other sites

It should be placed in the same folder as your... wait... you never registered the PEAR environment variables, did you? No wonder, seeing that the manual doesn't hint anything of it (the PEAR installer itself recommends it as an optional thing to do; on Windows it even generates a file for you to click and do the procedure for you). Is there a search engine or something? Wherever you find the file "phing" (no extension), that should be it. If you can't do that or don't find anything, then at least uninstall Phing (with "pear uninstall phing/phing"), and then before attempting to reinstall it, register your PEAR environment variables with the following commands:

export PHP_PEAR_SYSCONF_DIR=/var/root/export PHP_PEAR_INSTALL_DIR=/var/root/pear/share/pearexport PHP_PEAR_DOC_DIR=/var/root/pear/docsexport PHP_PEAR_BIN_DIR=/var/root/pear/binexport PHP_PEAR_DATA_DIR=/var/root/pear/dataexport PHP_PEAR_PHP_BIN=/var/root/phpexport PHP_PEAR_TEST_DIR=/var/root/pear/tests

(that's assuming the full path to your PHP executable is "/var/root/php"; adjust accordingly if not) You might have to restart after that.

Link to comment
Share on other sites

So I installed SVN and it also told me to edit the path by creating a hidden file called .bash_profile and adding the line: export PATH=/opt/subversion/bin/:$PATH then you have to let terminal know the file has changed by running: . .bash_profile I did the same for pear and now it works! I'm not sure what .bashrc is but I think you're supposed to put new paths in a file called .bash_profile. (Im on a mac 10.6 so i dont know if that makes a difference). PATH editing: http://www.troubleshooters.com/linux/prepostpath.htmInstalling SVN and adding svn to your path: http://www.rubyrobot.org/tutorial/subversion-with-mac-os-x

Link to comment
Share on other sites

More problems ... I ran these 2 commands and it installed phing. $> pear channel-discover pear.phing.info$> pear install phing/phing However, if I type in phing, it says command not found, but if I try and run those 2 commands above again, it says: Channel "pear.phing.info" is already initializedphing/phing is already installed and is the same as the released version 2.4.8install failed Any idea where it might be? If I type phing in Finder, it doesn't return anything. EDIT:I just uninstalled phing and reinstalled it and this is what it says:

sh-3.2# pear install phing/phingUnknown remote channel: pear.phpunit.deUnknown remote channel: pear.phpunit.deWARNING: "pear/PEAR_PackageFileManager" is deprecated in favor of "pear/PEAR_PackageFileManager2"Unknown remote channel: pear.pdepend.orgUnknown remote channel: pear.phpmd.orgUnknown remote channel: pear.phpunit.deUnknown remote channel: pear.docblox-project.orgDid not download optional dependencies: phing/phingdocs, pear/VersionControl_SVN, pear/VersionControl_Git, channel://pear.phpunit.de/PHPUnit, channel://pear.phpunit.de/PHP_CodeCoverage, pear/PhpDocumentor, pecl/Xdebug, pear/PEAR_PackageFileManager, pear/Services_Amazon_S3, pear/HTTP_Request2, channel://pear.pdepend.org/PHP_Depend, channel://pear.phpmd.org/PHP_PMD, channel://pear.phpunit.de/phpcpd, channel://pear.docblox-project.org/DocBlox, pear/PHP_CodeSniffer, use --alldeps to download automaticallyphing/phing can optionally use package "phing/phingdocs" (version >= 2.4.8)phing/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.4)phing/phing can optionally use package "pear/VersionControl_Git" (version >= 0.4.3)phing/phing can optionally use package "channel://pear.phpunit.de/PHPUnit" (version >= 3.6.0)phing/phing can optionally use package "channel://pear.phpunit.de/PHP_CodeCoverage" (version >= 1.1.0)phing/phing can optionally use package "pear/PhpDocumentor" (version >= 1.4.0)phing/phing can optionally use package "pecl/Xdebug" (version >= 2.0.5)phing/phing can optionally use package "pear/PEAR_PackageFileManager" (version >= 1.5.2)phing/phing can optionally use package "pear/Services_Amazon_S3" (version >= 0.3.1)phing/phing can optionally use package "pear/HTTP_Request2" (version >= 0.5.2)phing/phing can optionally use package "channel://pear.pdepend.org/PHP_Depend" (version >= 0.10.0)phing/phing can optionally use package "channel://pear.phpmd.org/PHP_PMD" (version >= 1.1.0)phing/phing can optionally use package "channel://pear.phpunit.de/phpcpd" (version >= 1.3.3)phing/phing can optionally use package "channel://pear.docblox-project.org/DocBlox" (version >= 0.15.0)phing/phing can optionally use package "pear/PHP_CodeSniffer" (version >= 1.3.0)downloading phing-2.4.8.tgz ...Starting to download phing-2.4.8.tgz (419,121 bytes).....................................................................................done: 419,121 bytesinstall ok: channel://pear.phing.info/phing-2.4.8

Link to comment
Share on other sites

If installation of Phing is OK, you should be able to find a file named "phing" somewhere (Phing's manual suggests the same folder as the PEAR executable; I say look for it also in PHP's folder and then anywhere on your file system).All the warnings you see are about the optional packages that Phing could use for some of its tasks. Regardless of them, the Phing executable must be present.If you read the "Did not download optional dependencies" warning, you'll see it ends with

use --alldeps to download automatically
i.e. you can uninstall and reinstall Phing like
pear install --alldeps phing/phing

to install Phing AND all mentioned extra packages.

Link to comment
Share on other sites

i typed phing into mac's Finder and it didn't return anything. im not sure where PHP is on the mac. I wasn't using PHP through my MAMP stack. I didnt even have it turned on. I think PHP is enabled on mac by default, but im not sure where and im having trouble finding it. In Terminal, I did have to do sudo su to be able to attempt to install phing, which then returns that it is already installed

Link to comment
Share on other sites

Could you "sudo" the finder? Maybe The PHP executable is in a folder that has no executable (i.e. traversable) bit set to it. The only way to bypass it is sudo-ing it.

Link to comment
Share on other sites

And then find the PHP/Phing executable... you said the finder doesn't show anything. Maybe if you run it with "sudo" status, it will.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...