how to use phpdoc webinterface? - php

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

Related

Using Pear's PHP codesniffer with MAMP Pro on mac

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.

Plesk - Adding Pear

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).

Where else could /usr/local/lib/php be?

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

Installing PEAR on wampserver

All the guides for installing PEAR on wampserver, such as the Symfony guide, say I am to run a go-pear.bat script within some PEAR directory.
I am on wampserver 2.1 and there is no PEAR directory and no go-pear batch script to be found.
Is this just different because I have a newer version? Is there somewhere I can download these missing installation scripts?
It's not installed per default on all setups.
But you can download the plain go-pear script for that: http://pear.php.net/go-pear
Either invoke it with php.exe go-pear or run it through your webserver as regular .php script. (It has a nice installation GUI!)
Rather new to pear myself, but my answer to a similar question:
Running Wampserver 2.2 on Win7 Professional 64bit working with PHP 5.3.8 I have found a few issues with standard way of installing with go-pear. I downloaded the go-pear.phar and ran that via cmd with no deprecated errors etc.
you could also just go to the pear site, download the zips and unzip them in the correct local folders (wamp/bin/php)
we've just solved a similar problem like this, where a copy of a live site set up on a local machine was hitting errors because PEAR was not installed. The installation process was hitting errors so we just downloaded and unzipped PEAR and the required modules directly into the correct directory.
problem solved.
Firts export in the PATH system, add you folder with php, p.e. if you have php 5.4.x in your wamp system:
PATH=...;C:\wamp\bin\php\php5.4.x;
Create a new folder p.e.:
C:\wamp\bin\php\pear\
If your php version is 5.3 or or newer you can use pyrus.phar.
Using pyrus.phar to install pear
php pyrus.phar install pear/PEAR-1.9.4
Export you PATH again:
PATH=....;C:\wamp\bin\php\pear;
you can use pear.bat, or pear.
pear.bat <arguments>
Check: for more information:
http://pear.php.net/manual/en/installationpyrus.introduction.php
http://pear2.php.net/
This worked for me on windows 7:
http://www.steptoinstall.com/install-pear-wamp-server-windows-7-8.html
NOTE: Make sure you open command prompt window in administration mode.
I downloaded the 32bit wamp and this includes the pear files. However it is best to install 1.9.2 by downloading go-pear.phar manually, as the default one didn't seem to work.
How it worked for me is,
I went to the PEAR official site and clicked on this link which brings you to go-pear.phar source. Then I saved the file by right clicking on the web page, under my php7.4 ( this is the PHP version I have set on my ENV variables ) folder.
Next opened up the command line as admin and did CD to that folder and ran the following command php go-pear.phar.
This started the PEAR installation process and asked few questions. At the end I was asked to double click on "PEAR_ENV" reg file which was inside the php folder and done.
Hope this will helpful for someone.

What's an appropriate include_path PHP/PEAR setting for Macports?

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.

Categories