How to set up PEAR on Mac OS X 10.5 Leopard

Asked
Active3 hr before
Viewed126 times

8 Answers

90%

Meta Stack Overflow , Stack Overflow help chat , Stack Overflow Public questions & answers ,Stack Overflow en español

So, for number 1, put a PHP page on your server that include the function call

phpinfo();

For number 2, run the following from your command line

php - r "phpinfo();" | grep '.ini'

Finally, and this is what I think your problem is, we need to ensure that the pear command line command is in your shell/bash path. That's what this error is refering to

** The 'pear'
command is not currently in your PATH, so you need to

There should be a file in your home directory named '.bash_profile'. It's a hidden file, so it won't showup in the Finder. Open it with a text editor. If you're having trouble because this is a hidden file, use the command line pico editor. Ctrl-X will save from pico

cd~
   pico.bash_profile

This file gets executed by your shell everytime you open a terminal window. We're going to add /usr/local/bin to your PATH, which means when you attempt to run a command, yoru computer will search for the command in this folder. Add the following line to the bottom of .bash_profile

export PATH = /usr/local / bin: $PATH

This is, more or less, equivilant to the following PHP code

$PATH = '/usr/local/bin:'.$PATH

You're adding /usr/local/bin as the first colon-delimited place to look for command, and then adding the rest of the existing path to it. Once you've added that line, close your terminal, re-open it, and then type

pear
load more v
88%

There's a few things that could be going wrong here, these are only guesses.,Your shell application (terminal, likely BASH in you're on OS X) has the PEAR directory in its include path,The php.ini file for your website has the PEAR directory in its include path,The php.ini file for your command line php application has the PEAR directory in its include path

So, for number 1, put a PHP page on your server that include the function call

phpinfo();
"

For number 2, run the following from your command line

php - r "phpinfo();" | grep '.ini'
"

Finally, and this is what I think your problem is, we need to ensure that the pear command line command is in your shell/bash path. That's what this error is refering to

** The 'pear'
command is not currently in your PATH, so you need to "

There should be a file in your home directory named '.bash_profile'. It's a hidden file, so it won't showup in the Finder. Open it with a text editor. If you're having trouble because this is a hidden file, use the command line pico editor. Ctrl-X will save from pico

cd~"pico .bash_profile"

This file gets executed by your shell everytime you open a terminal window. We're going to add /usr/local/bin to your PATH, which means when you attempt to run a command, yoru computer will search for the command in this folder. Add the following line to the bottom of .bash_profile

export PATH = /usr/local / bin: $PATH "

This is, more or less, equivilant to the following PHP code

$PATH = '/usr/local/bin:'.$PATH "

You're adding /usr/local/bin as the first colon-delimited place to look for command, and then adding the rest of the existing path to it. Once you've added that line, close your terminal, re-open it, and then type

pear "
load more v
72%

PEAR was removed by Apple from 10.5 for one reason or another. Here’s how to get it back:,Make sure you have a php.ini file in /etc/. This isn’t available by default. To create one enter the following:,Enter /usr/local/pear as the path and press Enter,Press Enter to start install

If all is well, you should see the following output (or similar):

PEAR Version: 1.7 .2
PHP Version: 5.2 .5
Zend Engine Version: 2.2 .0
Running on: Darwin glen - scotts - macbook.local 9.3 .0 Darwin Kernel Version 9.3 .0: Fri May 23 00: 49: 16 PDT 2008;
root: xnu - 1228.5 .18~1 / RELEASE_I386 i386
65%

Open up your trusty Terminal application by going to /Applications/Utilities.,Answer: Zend_Test extends PHPUnit. Therefore, we need to start by installing PHPUnit. The easiest way to install PHPUnit is by installing PEAR. Therefore…you get the idea. We need PEAR. I’ll walk you through the process I took to install PEAR on Mac OS X 10.5 (Leopard).,Press enter to continue with the installation. When asked, you can accept the additional PEAR packages by typing Y and pressing enter.,First, we’ll switch over to a user that has enough permission to do anything, our super user:

First, we’ll switch over to a user that has enough permission to do anything, our super user:

sudo su -

sudo su -
load more v
75%

After upgrading to Snow Leopard, PHP may be disabled. To activate PHP, you need to load the PHP 5 module in the Apache configuration file. Open /etc/apache2/httpd.conf file with vi or TextMate. Locate this line (line 115 for me):,Step by step Snow Leo becomes as usable as Leopard for webdaev.,Download the PHP Remote Debugging file for Mac OS X. Unarchive the downloaded file, and you should see a new folder like this:,Good tutorial. I had to change some paths as I'm using Entropy's PHP module instead of the stock Mac version on OS 10.5.8

After upgrading to Snow Leopard, PHP may be disabled. To activate PHP, you need to load the PHP 5 module in the Apache configuration file. Open /etc/apache2/httpd.conf file with vi or TextMate. Locate this line (line 115 for me):

#LoadModule php5_module libexec / apache2 / libphp5.so
load more v
40%

All Mac OS X versions up until 10.5 come with PEAR by default. Mac OS X 10.5 (Leopard) users will need to install PEAR using the standard installation instructions. , Find out the stability or version number of the latest release and install it directly. , Find out the stability or version number of the latest release and install it directly. $ pear install Packagename-alpha $ pear install Packagename-1.5.3 , The package in question does have releases, but none that are stable. There are two solutions.

Even if not all packages do have end-user documentation in the PEAR manual, nearly all of the packages do include examples. The examples are automatically installed when you install a package via the command line installer and are located in $peardir/docs/$packagename/.

$peardir / docs / $packagename /
load more v
22%

В конечном счете я пытаюсь установить PEAR, чтобы легко установить PHPUnit. Я хочу настроить среду разработки Mac, Apache, MySQL, PHP, PHPUnit, чтобы я мог тестировать локально. У меня уже работают Apach, MySQL и PHP. Теперь все, что мне нужно, это PHPUnit, а это значит, что мне нужно PEAR, чтобы установить его. ,С первой попытки я думаю, что include_path был закомментирован из файла php.ini, но так как я уже изменил эту строку, и это не первый раз, когда я пытаюсь установить, я получаю следующее сообщение: ,Я меняю Installation prefix на /usr/local, нажимаю enter, чтобы продолжить, набираю Y , чтобы также установить PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2 . В конце концов, все установлено. ,Я все понял. Вы "HAVE TO" запускаете go-pear.php в том месте, где вы хотите установить pear, поэтому вам нужно запустить его под /usr/local, если вы хотите, чтобы двоичный файл pear был установлен под /usr/local/bin :-)

Следуя этому учебнику, я делаю следующее:

curl http: //pear.php.net/go-pear > go-pear.php
   sudo php - q go - pear.php

Я нажимаю enter, пока не попадаю в список с 7 включенными путями:

1. Installation prefix($prefix): /Users/andrew
2. Temporary files directory: $prefix / temp
3. Binaries directory: $prefix / bin
4. PHP code directory($php_dir): $prefix / PEAR
5. Documentation base directory: $php_dir / docs
6. Data base directory: $php_dir / data
7. Tests base directory: $php_dir / tests

С первой попытки я думаю, что include_path был закомментирован из файла php.ini, но так как я уже изменил эту строку, и это не первый раз, когда я пытаюсь установить, я получаю следующее сообщение:

WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
</usr /local/PEAR>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.

Would you like to alter php.ini </private /etc/php.ini>? [Y/n] :

Я набираю Y и позволяю pear автоматически обновлять мой путь включения:

php.ini </private /etc/php.ini> include_path updated.

Current include path : .:/usr/share/pear
Configured directory : /usr/local/PEAR
Currently used php.ini (guess) : /private/etc/php.ini

Я нажимаю enter, чтобы продолжить, и получаю следующее сообщение:

The 'pear'
command is now at your service at / usr / local / bin / pear

   **
   The 'pear'
command is not currently in your PATH, so you need to **
   use '/usr/local/bin/pear'
until you have added
   **
   '/usr/local/bin'
to your PATH environment variable.

Run it without parameters to see the available actions,
try 'pear list'
to see what packages are installed, or 'pear help'
for help.

For more information about PEAR, see:

   http: //pear.php.net/faq.php
   http: //pear.php.net/manual/

   Thanks
for using go - pear!

   PHP Warning: rmdir(/usr/local / temp): Not a directory in /Users/andrew / go - pear.php on line 1237

Warning: rmdir(/usr/local / temp): Not a directory in /Users/andrew / go - pear.php on line 1237
load more v
60%

Unlike previous version of OS X, Leopard doesn't come with PHP's PEAR repository installed by default. Luckily, installing is quick and painless. From a command line:,Just press enter to select all the default choices except for the installation directory. For that, use /usr/local. (Thanks, Steve.),I keep an updated list of my favorite internet writers. In a world full of firehoses, these are the few people who I make sure to ready everything they publish.,If you've found any of the posts or free apps on this blog helpful, you can buy me a coffee. It's certainly not neccessary but much appreciated.

Unlike previous version of OS X, Leopard doesn't come with PHP's PEAR repository installed by default. Luckily, installing is quick and painless. From a command line:

curl http: //pear.php.net/go-pear > go-pear.php
   sudo php - q go - pear.php
load more v

Other "undefined-undefined" queries related to "How to set up PEAR on Mac OS X 10.5 Leopard"