I am using XAMPP 1.8.1.
I need to write code with PHPUnit.
When I try to install PEAR using command prompt, I get the message below:
Are you installing a system-wide PEAR or a local copy?
Could some one suggest which option I should use?
Thanks in advance.
PEAR is usually installed system-wide. The benefit of this is that the various packages can be reused between different projects.
One reason why you might install a local copy of PEAR is that the administrator[s] of the server you are installing on might be reluctant to install additional packages or upgrade existing ones.
By performing a local install of PEAR you can choose the location of where the PEAR installer places the packages/PEAR code that you install.
So, another reason for installing local, even multiple, copies of PEAR is to have separate installs for each project you might be working on, though using Composer in this scenario is much more common place.
Naturally if you do install a local copy of PEAR then you will need to adjust your include-path accordingly.
Related
I have an old project that relies heavily on PEAR. I need to run the script that installs pear packages daily on a clean virtual machine. In other words, I have to install packages daily since it's a new vm everyday.
Now that PEAR is down and there is no ETA, I can't instal from php.pear.net
My question is how to install pear packages now that pear server is down.
Download the zip you need from https://github.com/pear/ for example: https://github.com/pear/Pager and then pear install package.xml
Unfortunately, this is a terrible solution and it remains to wait until the party gets up.
I tried install package pear Pager in this way:
Download zip from github -> in console I went to the downloaded folder -> I used the command: sudo pear install package.xml
then Pager is installed, but with many package this is very problematic...
I got info from another dev that I have to wait for the website to get up, but it has been going on for so long...
I am trying to get my head around how to install composer. Really confusing!
I have downloaded the windows installer and during the installation was asked to locate "php.exe". Does that mean I need to have a local server (Wamp) installed?
Lets say I manage to install composer on my PC. How do I get it to work on my web host? Do i copy files there or do I need to install composer on web host as well?
Composer requires php executable, but not webserver. So installing php from php site is sufficient. However, if you plan to develop or run php applications on your computer, you would prefer to install full stack (eg wamp) right away.
Composer is needed only to install and update dependencies, once you do it, all are just files, and you transfer them as you transfer other files to your webhost. So copy, no need to install composer on web host.
How to install pear on project local?
Only install system global (and copy manually to project local) ?
The Answers #greg0ire provided (+1) should work out.
If you are using PHP 5.3 you can also look into "the next version of the pear installer" pyrus.
It can make it easier mainting different configurations
See this page of the manual : Installation of a local PEAR copy on a shared host
I've just installed a PEAR package (Event_Dispatcher) and I can't use the classes in that package. When I run the command pear list I see the new package, however I see that the classes in the package are saved in /usr/lib/php (I have a Mac).
Is there a loading part after installing a PEAR package? How exactly do I move the files to the right place? Can I simply cut and paste the folder to the pear root folder?
Thanks!
Most PEAR packages have to be included via the usual include() and require() functions. They're not precompiled binaries, like (say) the MySQL driver (mysql.so/mysql.dll) are. As long as /usr/lib/php is in your include_path, PHP should be able to load up the package automatically when you do include('nameofpackage.php').
When PEAR is installed it usually automagically configures your php.ini to add the PEAR library path to the php.ini. Then, for each package, the authors will usually provide a file that will load the library for you which sits in the root of this PEAR lib directory.
For example, a PEAR package MDB2 has a load of different classes located under /MDB2, but there's also a PHP script at /MDB2.php, so all you need to do from your PHP code is this:
require_once("MDB2.php").
You'll obviously need to keep track of what you have installed on your local dev machine and make sure it's installed on the production server(s) too.
I want to install PEAR on PHP 5, so I can use Spreadsheet_Excel_Writer.
I don`t know how to install it on my ISP nor my personal MacBook.
Thoughts for both?
The PEAR Manual has a quite extensive list of instructions on how to install the PEAR manager on Windows, *NIX and Mac OS X. The manual also has a section on installing PEAR remotely, for example using FTP. Following those instructions, you should be able to install PEAR (nearly) anywhere. :)
From the command line, do this:
pear install Spreadsheet_Excel_Writer
You can also download the package directly here without using PEAR: http://download.pear.php.net/package/Spreadsheet_Excel_Writer-0.9.1.tgz. It's pretty easy to use if you have the script located anywhere within your include path.
For your personal computer, using the "pear" script that ships with most PHP distributions is a good idea.
For shared hosting, you can
Track your dependencies manually, and copy all the appropriate files to the server yourself
With pear installed, do "pear install -R/my/root_dir -a Spreadsheet_Excel_Writer". This will install the package and all dependencies to the specified root directory. Copy this installation to your webhost.
You should also have a look at "pear help" and "pear help install".
You can't install pear to your isp's core. But you can install the individual files from pear's site and upload them to your host:
http://pear.php.net/package/Spreadsheet_Excel_Writer/download