I currently have a linux server with Plesk installed. I need to have pear functionality, however I'm having difficulty understanding the documentation.
Viewing phpinfo(), the configure command contains --without-pear.
I have 'edited' my httpd.include file to extend the openbase_dir value to /usr/share/pear and also used this in the include path.
In the pear manual, it states:
When using PHP, the PEAR Package Manager is already installed unless one has used the ./configure option --without-pear.
Does this mean I need to install the pear package manager again? Do I need to reconfigure PHP with --with-pear? If so how do I do this?
After this step, is there anything else I need to do to enable pear?
Many thanks
Phil
Personally, I have just manually installed PEAR with an apt-get install php-pear and then I included it in php parameter in each domains and subdomains on my plesk panel. So I added /usr/share/php (which is PEAR directory, you can get it with pear config-get php_dir) in include_path and open_basedir sections (you can see here how to manage PHP settings on plesk).
Related
I'm using Batavi to build an online store, and when I install it is giving error like
PEAR is not installed on this server or path to a directory with PEAR is not specified in the include_path.
and another error like
Version of Apache on your server has been hidden.
I don't have any idea how to set it up, may be with php.ini file, can some one help me?
Depending on your operating system probably there should be a pear package.
For example on ubuntu linux it is php-pear, and you can install it like this:
sudo apt-get install php-pear
If pear is only missing from your include_path, you should add it in your php.ini files. (somewhere around /etc/php*)
In my case /etc/php5/*/php.ini:
include_path = ".:/usr/share/php"
But you should verify the path.
I’d like to ask for some help getting Pear’s PHP Code Sniffer set up properly.
I’m using MAMP pro 2.0.5 on a Mac PB 10.7.4 with PHP 5.3.6.
I do have Pear installed and can run pear commands, when I installed the PHP_CodeSniffer channel I didn’t get any errors but I can’t trigger any commands.
Here is a screen shot of my command line:
https://skitch.com/stephanief0042/etuck/alohamediaworks-bash-100x40
I was able to reference this post:
Putting PEARs php_dir into include_path in php.ini
But my include path seems correct:
include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php:/Applications/MAMP/bin/php/php5.3.6/bin/pear"
When I traced the path to the PHPCS install I found it’s executable file on this path: Users/alohamediaworks/pear/bin/phpcs
I’m not sure if i’m one symlink from being able to use this or not, any help or suggestions would be welcome.
PEAR will install bin files like PHPCS into a configurable location. You can see this location by running pear config-show | grep bin_dir.
The value here is probably currently /Users/alohamediaworks/pear/bin
You might want to just set it to /Applications/MAMP/bin or somewhere local on your Mac, like /usr/local/bin.
Before you do this, it is worth uninstalling PHP_CodeSniffer, and also checking that PEAR knows where PHP is by running pear config-show | grep php_bin.
I'll assume both values need changing:
pear uninstall PHP_CodeSniffer
pear config-set bin_dir /Applications/MAMP/bin/php/php5.3.6/bin
pear config-set bin_dir /Applications/MAMP/bin
pear install PHP_CodeSniffer
(check that the paths are valid first and that you don't have friendlier symlink versions)
You need the php_bin to be correct because PEAR will change the #! line of all bin files (like phpcs) on install to point to your PHP executable. The bin_dir is important to ensure bin files are placed into a directory that is in your path. Uninstalling PHP_CodeSniffer is required so old files are not left around (PEAR wont move them).
Hope that helps.
I'm developing an application in PHP on a Linux server. The server has at least two different versions of php installed on it: 5.2.0 and 5.2.9.
The 5.2.0 version has the following directory /usr/local/lib/php in the include_path in php.ini.
I need to find out where the 5.2.9 version of this directory is located.
I checked the include_path setting in the 5.2.9 php.ini but it only has . and /usr/share/pear for include_path.
(Note that I just installed pear right now, since the 5.2.9 php was originally configured without pear.) The files in /usr/share/pear do not seem to match what I see in /usr/local/lib/php and it seems a little absurd to tell pear that php_dir is /usr/share/pear. Any ideas?
UPDATE - Is it possible that /usr/local/lib/php also belongs to php 5.2.9? Is there anything within this directory itself I can look at, to see?
If the directory you're looking for exists (it might not if you excluded pear during install): The default location would be /xxx/lib/php where /xxx is the installation prefix.
For example, on one of my servers, one of my PHP executables (I have 4 versions installed) is located /custom/php5.3.5/bin/php so it's corresponding PEAR/general library directory is /custom/php5.3.5/lib/php
(/custom/php5.3.5 being the installation prefix, normally it would be /usr/local or /usr.)
If your lib/php directory has a pearcmd.php file, call (yourphpbin) pearcmd.php info pear and it should be able to tell you pear version, it's requirements and whatnot. (If pearcmd.php exists, there's a good chance pear exists in that directory.) The pear shell-script would by default be at /xxx/bin/pear again /xxx being the installation prefix.
As far as I'm aware, you can set it up so that PEAR is shared among multiple versions of PHP. I would assume that's how the /usr/share/pear one is set up. (Distribution repository-provided?) Not sure if the same holds true for pecl. If you have multiple installs of pear, you just need to make sure you install the packages you want to use into the right pear install.
PHP will happily use whatever PEAR installation you tell it to in include_path.
Try the whereis command. It usualy gets you the binary, man page and configuration paths.
$ whereis php
You can then check the information each PHP version outputs:
$ /path/to/php.binary -i
There should be information about the included paths and configuration files used.
To find it, use:
]# sudo updatedb
]# locate php
That might return LOTS of results, you can filter in various ways. I usually try this first:
]# locate php | grep bin
You can try this command in the console:
which php
I'm using Macports for my PHP development. I thought that everything associated with Macports should be located under/opt/local, but I can't load the PEAR::Mail_Mime package I just installed through PEAR. I did confirm that the path to pear is /opt/local/bin/pear, but I have no idea where it dumped the package files, so I don't know how to include them in my path. Any pointers?
If you used the pear command to install the package, you could also do
$ pear list mail_mime
to get a listing of all files from that package and where they were installed to. It's a handy way of looking for example files, especially when used with grep ;-)
Pear files are typically installed in a share/php directory although I'm not on my mac right now so I can't check exactly where that might be. You can find that directory using locate though. From your terminal type:
$ locate PEAR.php
It should return something like /usr/share/php/PEAR.php - In this example /usr/share/php should be in my include path. Mail.php and Mail/mime.php should also be in this directory.
i have phpdoc through mamp. and i followed their tutorial, typed this in the Terminal.
pear config-set data_dir /path/to/document_root/pear
of course i changed the /path/to/document_root to my web space folder.
but then what? how can i access phpdoc through webinterface?
I never installed phpdocumentor on mamp but I did on wamp. What you need to do is install pear on your mamp. When you did you can just copy the phpdoc web folder to your web root and go to it by visiting it in the browser.
For a bit more information on installing take a look here:
Resource 1
Resource 2
If you have pear's data_dir set as you show above, and your Apache server is running, you should be able to reach the phpDocumentor web interface at http://localhost/pear/PhpDocumentor/index.html