I am following along with the tutorials in 'Easy PHP Websites with Zend Framework' and wanted to install PHPUnit.
System: Mac OS x Lion, PHP running locally (Not MAMP)
Pear was installed and working fine, I upgraded it to the latest.
Installed PHPUnit using
sudo pear install phpunit/PHPUnit
terminal did some work and installed it without errors
The in my terminal I did
phpunit --version
this returns/does nothing as follows (Username removed)
Machine:~ Username$ phpunit --version
Machine:~ Username$ sudo phpunit --version
Machine:~ Username$
Was worried it some how did not install so I check for the PHPUnit files and they do exist under /usr/lib/php/phpunit
Also checked that the phpunit exe exists which it does under /usr/bin
edited .profile as well as .bash_profile to include the /usr/bin path to have
export PATH=/usr/bin:$PATH
then restarted terminal
running
echo $PATH
shows
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/Users/xxxxx/development/frameworks/ZendFramework-1.11.11/bin
php.ini includes is
include_path = ".:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library"
Where xxxxx is my username on the Mac
even going into /usr/bin in terminal and using phpunit --version returns nothing
in case its relevant my PEAR config shows
Configuration (channel pear.php.net):
=====================================
...
...
PEAR executables directory bin_dir /usr/bin
PEAR documentation directory doc_dir /usr/lib/php/doc
PHP extension directory ext_dir /usr/lib/php/extensions/.....
PEAR directory php_dir /usr/lib/php
PEAR data directory data_dir /usr/lib/php/data
PHP CLI/CGI binary php_bin /usr/bin/php
php.ini location php_ini <not set>
....
....
PEAR Installer temp directory temp_dir /private/tmp/pear/temp
PEAR test directory test_dir /usr/lib/php/test
PEAR www files directory www_dir /usr/lib/php/htdocs
....
Also added the pear and phpunit directory to my php.ini includes path list.
Am at a loss as to why this does not want to work. Am sure its me and I have done something incorrectly....Any help appreciated.
Ok, solved this, finally after much reading and fiddling. Issue was with PEAR, not PHPUnit itself.
Found the issue by following the set up for PEAR onhttp://pear.php.net/manual/en/installation.checking.php
php.ini change from
.:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library:/usr/lib/php/PHPUnit
to
.:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library:/usr/lib/php
solved this issue immediately.
phpunit --version now works
Related
I installed composer using home brew on my Utilities terminal on my Mac.
When I try to use packages installed through composer, I get that it isn't installed. For example, I can run laravel new appname in the Mac terminal, but it won't let me run it in VScode terminal (using zsh). I get the error zsh: command not found: laravel.
Can someone help so that the VScode terminal uses the packages installed in my Mac terminal?
My /etc/paths file looks like this:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/melaniecarr/.composer/vendor/bin
You need to add the relevant directories to your PATH in ~/.zshenv. Try which laravel in the shell that works to see what directories you need to add. E.g.:
❯ which watch
/usr/local/bin/watch
❯ export PATH="/usr/local/bin:$PATH" # needs to be in ~/.zshenv to be permanent
I am new to mac and am trying to get pear to run from the terminal.
All the scripts are added to the MAMP folder and if I run:
$ sudo /Applications/MAMP/bin/php/php5.6.10/bin/pear
everything is fine.
However, if I run $sudo pear or pear I get a message: "pear command not found"
My $PATH variable looks like this:
/Applications/MAMP/bin/php/php5.6.10/bin/pear:/usr/bin:/bin:/usr/sbin:/sbin:
When I look for pear with $ locate bin/pear I get the same location as in the path:
/Applications/MAMP/bin/php/php5.6.10/bin/pear
Any idea what can be wrong?
Copied -- in essence -- from a comment:
Th $PATH environment variable should contain a list of directories to be searched for a command. Having the executable itself as part of the path doesn't help with resolving its location.
I've tried all kinds of fixes to get php_codesniffer working with OSX and Pear and am having no luck. The installation works, the scripts are there, but when I run, for example, phpcs -h, nothing happens.
I am doing the following to install and try to run:
chris#DEATHSTAR:~$ pear clear-cache
reading directory /var/folders/r5/3s2lsmc10zj07nw56xbx1k1m0000gn/T//pear/cache
14 cache entries cleared
chris#DEATHSTAR:~$ pear install php_codesniffer
Unknown remote channel: pear.phpunit.de
Did not download optional dependencies: channel://pear.phpunit.de/PHP_Timer, use --alldeps to download automatically
pear/PHP_CodeSniffer can optionally use package "channel://pear.phpunit.de/PHP_Timer"
downloading PHP_CodeSniffer-1.4.6.tgz ...
Starting to download PHP_CodeSniffer-1.4.6.tgz (402,882 bytes)
.................................................................................done: 402,882 bytes
install ok: channel://pear.php.net/PHP_CodeSniffer-1.4.6
chris#DEATHSTAR:~$ which phpcs
/Applications/MAMP/bin/php/php5.4.10/bin/phpcs
chris#DEATHSTAR:~$ phpcs -h
chris#DEATHSTAR:~$
The PHP directory is correct in Pear config:
chris#DEATHSTAR:~/.vim$ pear config-show | grep php_bin
PHP CLI/CGI binary php_bin /Applications/MAMP/bin/php/php5.4.10/bin/php
Not sure what else I can do to troubleshoot?
Possible related note: PHP Mass Detector does essentially the same thing...it installs correctly, but running it seemingly does nothing as well!
I think the phpcs binary file is not inside your $PATH. Use the follow steps to figure out if this is true:
Call the codesniffer on your command line with entering the full path:
$ /Applications/MAMP/bin/php/php5.4.10/bin/phpcs -h
If you get the help output then proceed with step 2. If not something else is broken in your setup.
Export this path to $PATH:
$ export PATH=$PATH:/Applications/MAMP/bin/php/php5.4.10/bin/phpcs
Call the CodeSniffer like you try before:
$ phpcs -h
To make this change permanent you need to insert the command from 2. into you .profile/.bashrc/.zshrc or whatever you use as a shell
I'm trying to run a command that downloads a bit of software using PEAR installed with MAMP.
Here's the command I run in Terminal:
pear channel-discover pear.phpdoc.org
The Terminal responds with:
-bash: pear: command not found
Could someone please advise how to access PEAR that comes pre-installed with MAMP?
Path to MAMP on my Mac is /Applications/MAMP/
I do not use mamp but i think you can find the pear here:
/Applications/MAMP/bin/php5.3/bin/pear
you can simply add some alias to make it shorter, something like
alias mamppear="/Applications/MAMP/bin/php5.3/bin/pear"
How do i include Pear's QuickForm into a php file if Pear is already installed in xampp?
I ran go-pear.bat from the command line, and it ran a setup program to configure my system for PEAR.
When it was finished I was left with some new folders and a pear.bat file. I tested it with "pear install -f Text_CAPTCHA" and everything seemed to work.