开发者

Installing PEAR without access to Internet

I need to install PEAR on a server which does not have outsite access to the net. There is no go-pear.bat in the php folder and even if it had go-pear.bat i think it needs access to the net.

I looked an the Installing PEAR from a local copy from the PEAR website. But it needs PEAR to be already installed for it to work.

So do any of you guys know how to install PE开发者_运维百科AR without access to internet?


You don't need PEAR installed on the webhost, just on your local machine. The two main approches are

  • Track your dependencies manually, and copy all the appropriate files to the server yourself
  • With pear installed on your local machine, do pear install -R/my/root_dir -a PEAR. This will install the PEAR package and all dependencies to the specified root directory. Copy this installation to your webhost.

I think it's possible to use pear to manage an installation via FTP also. I never tried.

You should also have a look at "pear help" and "pear help install".


There is a way to do this if you are on Windows and have the PHP installer.

You can select, during the PHP installation time, the PEAR option under extension menu when selecting the components for PHP installation in order to install PEAR package.

If you already have PHP installed, you just have to click on the installer to choose "modify", and choose the correct option.

http://lh4.ggpht.com/_SDci0Pf3tzU/SgBXLClDWEI/AAAAAAAAEuI/TgnBA_SEHFs/s400/pear%20install.jpg


I wrote an article on this very subject:

http://christian.roy.name/blog/install-pear-without-network-no-internet-accessoffline

It will allow you to use the pear command as well.

Create temporary folder that I will get ride of later.

mkdir pear-temp
cd pear-temp

Upload all the PEAR packages to that temp folder (using SFTP, FTP, Whatever).

If you use a USB key, then you copy them all like this:
cp /mnt/usb/*.tgz ./

Extract the core packages in a separate folder.

mkdir lib
tar x -C lib -zf PEAR-*.tgz
tar x -C lib -zf Console_Getopt-*.tgz
tar x -C lib -zf Archive_Tar-*.tgz
tar x -C lib -zf Structures_Graph-*.tgz

This bash function is to be able to set the include_path joined by colons.

function join() {
    local IFS=$1
    shift
    echo "$*"
}

pear requires output buffering and needs to load all the core packages from the lib folder.

PHPOPT="-d output_buffering=1 -d include_path=.:$(join ':' lib/*)"

First we setup our configuration file.

php $PHPOPT lib/PEAR-*/scripts/pearcmd.php config-create $HOME/ $HOME/.pearrc

Now we install ALL our packages. Make sure you have all the required dependencies as well.

php $PHPOPT lib/PEAR-*/scripts/pearcmd.php install -o -O *.tgz

Cleanup

cd ..
rm -Rf pear-temp

Put pear in your path:

PATH="$PATH:$HOME/pear"

Edit your .profile or .bashrc if you want this to be permanent.

Edit your php.ini too or add it using set_include_path() function, whichever :)

Drink to sucess!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜