I'm having trobule installing phpDocumentor via PEAR on a CentOS machine and I don't even know if this is pear or php related.
Here are the commands that I executed and their output:
# pear -v install phpdoc/phpDocumentor
## http://pastebin.com/2ijRG9KW
# /usr/local/bin/phpdoc
-bash: /usr/local/bin/phpdoc: No such file or directory
# tree -a -h /usr/local/lib/php/phpDocumentor/
## http://pastebin.com/NjynYKPL
I've included the tree command because I'm thinking something is not OK there...
At first glance, is this a PEAR or phpDocumentor issue?
Edit
Tried
# whereis phpdoc
phpdoc: /usr/local/bin/phpdoc
But
# cd /usr/local/bin
# ls -l | grep -i phpdoc
lrwxrwxrwx. 1 root root 48 Nov 23 21:46 phpdoc -> /usr/local/lib/php/phpDocumentor2/bin/phpdoc.php
-rwxr-xr-x. 1 root root 1039 Nov 24 21:31 .tmpphpdoc*
Guess what...
-bash: cd: /usr/local/lib/php/phpDocumentor2: No such file or directory
But there is a phpDocumentor folder (instead of phpDocumentor2) whose tree is available on this pastebin
I encountered the same issue and found there was no phpdoc link in my folder /usr/local/bin
To remedy the problem, I used pear config-show to allow me to view where the PEAR Bin directory is and then created a symbolic link that the phpdoc file in that location.
My PEAR Bin directory is set to: /usr/local/Cellar/php55/5.5.8/bin/
My Local Bin directory is set to: /usr/local/bin
To create the link:
ln -s /usr/local/Cellar/php55/5.5.8/bin/phpdoc /usr/local/bin/phpdoc
You can use pear config-show to see what directory it uses as its bin_dir, which is where the PEAR installer puts its "binaries". I had thought that the main Linux distributions had preconfigured their PEAR setups to use /usr/bin as the right location, so you might try /usr/bin/phpdoc. Granted, /usr/bin is almost always in your default PATH, so just trying phpdoc along should usually be sufficient.
That memory limit error from the PEAR installer means that the PEAR installer itself crashed while attempting to install phpDocumentor. You'll need to edit your php.ini file to increase the value of the memory_limit parameter. It looks like right now it's defaulted to a tiny 8MB. I'd suggest at least 256MB unless this is a small/old computer. You should then try a reinstall (pear install --force phpdoc/phpdocumentor). I expect the --force will be necessary since PEAR might think it had installed it successfully already. If install gives trouble, then try update --force instead.
In the same folder where I've executed pear install I found an error_log file:
[23-Nov-2013 22:27:54 UTC] PHP Fatal error: Allowed memory size of
33554432 bytes exhausted (tried to allocate 8192 bytes) in
/usr/local/lib/php/PEAR/Installer.php on line 580
Gotcha.
Related
I try to install openswoole on my mac machine. I have this issue when installing it.
/usr/local/Cellar/php#7.4/7.4.29/include/php/ext/pcre/php_pcre.h:25:10: fatal error: pcre2.h: No such file or directory
#include "pcre2.h"
I used the command brew install pcre to fix this issue as others recommend, but I always get the same result. I try to open the folder pcre I only see one php_pcre.h file inside it.
Here's simplest solution. I have finally solved my problem. I used PHP 8.1.7 - Mac Pro 2022 - Apple Silicon (M1)
My errors: fatal error: 'pcre2.h' file not found
The solution that I used:
1. brew install pcre2
2. ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /opt/homebrew/Cellar/php/8.1.7/include/php/ext/pcre/pcre2.h
Please check your path again when use `ln -s`
3. sudo pecl install ... something you want to install :) **openswoole** with you :).
Success Installation:
Hope it help you :) Thanks
try:
sudo ln -s /opt/local/include/pcre.h /usr/include/ "replace your file location here"
sudo pecl install apc
For M1 MacBooks, this is how I fixed that error when installing rdkafka.
pecl install rdkafka
Error
/Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
Solution
ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/pcre2.h
See the new link
➜ cd /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre
➜ ls -l
total 8
lrwxr-xr-x 1 ddhondup admin 48 Oct 6 15:29 pcre2.h -> /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h
-rw-rw-r-- 1 ddhondup admin 3970 Oct 1 2021 php_pcre.h
After adding the link, it worked.
Build process completed successfully
Installing '/Applications/MAMP/bin/php/php8.0.8/lib/php/extensions/no-debug-non-zts-20200930/rdkafka.so'
install ok: channel://pecl.php.net/rdkafka-6.0.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=rdkafka.so" to php.ini
I just installed PEAR but it is using an incorrect path for PHP, /usr/bin/php, rather than the correct one, /usr/bin/php74.
This means it won't run at all, so I can't even run pear uninstall pear, because it (like any other pear command) just errors out with /usr/bin/pear line 28: /usr/bin/php: No such file or directory
How do I fix this? Can I just rm -rf /usr/bin/pear and then reinstall with pacman?
(For reference I am using Arch Linux)
I was curious about this so I took a bit of fun time to play with pear.
So, first I installed it through my favorite - and not deprecated yet - AUR helper.
$ my-awesome-helper -S php-pear
Then I tried to install XML_Util (as an example)
# pear install XML_Util
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading XML_Util-1.4.5.tgz ...
Starting to download XML_Util-1.4.5.tgz (19,191 bytes)
......done: 19,191 bytes
install ok: channel://pear.php.net/XML_Util-1.4.5
# echo $?
0
From here, I was sure that it is working so I uninstalled it.
# pear uninstall XML_Util
uninstall ok: channel://pear.php.net/XML_Util-1.4.5
Now, how can we break it or change the location of the PHP binary?
The way to go is to follow the documentation. For our case, it is located here.
It first states:
PEAR has a number of configuration options that you can change. Getting an overview of them is as easy as issuing a
$ pear config-show
I did it a bit more precisely:
# pear config-show | grep bin
PEAR executables directory bin_dir /usr/bin
PHP CLI/CGI binary php_bin /usr/bin/php
Signature Handling Program sig_bin /usr/bin/gpg
Yet another question: How to change the value of php_bin?
Let's get back to the documentation. It now states:
Reading single values is accomplished by using config-get. The following command will show you where all the .php files of your installed pear packages reside.
$ pear config-get php_dir
/usr/share/pear
Changing a value is as easy as retrieving it:
$ pear config-set preferred_state beta
config-set succeeded
Therefore, I changed it to something that is not the PHP binary.
# pear config-set php_bin /tmp/my-awesome-bin
config-set succeeded
Let's check the change:
# pear config-get php_bin
/tmp/my-awesome-bin
We are now sure that we changed the PHP binary location.
Let's rerun our first command:
# pear install XML_Util
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading XML_Util-1.4.5.tgz ...
Starting to download XML_Util-1.4.5.tgz (19,191 bytes)
......done: 19,191 bytes
install ok: channel://pear.php.net/XML_Util-1.4.5
It's not broken. Weird !?
From here, I thought, I did something wrong so I rechecked everything I did and I indeed followed the documentation without success.
My last resort is always to look at the file or executable to try to understand its behavior. So I did this time too.
It turns out that pear is a simple Shell script. At the time I'm writing this it (/usr/bin/pear) looks like this:
#!/bin/sh
# first find which PHP binary to use
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
PHP="$PHP_PEAR_PHP_BIN"
else
if test "/usr/bin/php" = '#'php_bin'#'; then
PHP=php
else
PHP="/usr/bin/php"
fi
fi
# then look for the right pear include dir
if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
INCDIR=$PHP_PEAR_INSTALL_DIR
INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
else
if test "/usr/share/pear" = '#'php_dir'#'; then
INCDIR=`dirname $0`
INCARG=""
else
INCDIR="/usr/share/pear"
INCARG="-d include_path=/usr/share/pear"
fi
fi
exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$#"
Here is the relevant part regarding your question:
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
PHP="$PHP_PEAR_PHP_BIN"
else
if test "/usr/bin/php" = '#'php_bin'#'; then
PHP=php
else
PHP="/usr/bin/php"
fi
fi
Basically:
If the PHP_PEAR_PHP_BIN environment variable is declared. Use it.
Otherwise, if the php_bin variable (pear config) is set, and is equal to /usr/bin/php use php as executable.
If both (1) and (2) failed; use the /usr/bin/php binary as executable.
That explains a lot about why it is still working.
So, I tried again to break it again but this time with the PHP_PEAR_PHP_BIN environment variable.
# PHP_PEAR_PHP_BIN=/tmp/my-awesome-bin pear install XML_Util
/usr/bin/pear: Zeile 28: /tmp/my-awesome-bin: Datei oder Verzeichnis nicht gefunden
This time I have the same error like the one you posted. Meaning that I could break pear and reproduce your issue.
Now the solution-s to your problem after understanding what is happening:
You can manually run export PHP_PEAR_PHP_BIN=/usr/bin/php74 before running pear. This solution is temporary and user-wide.
You can put the export PHP_PEAR_PHP_BIN=/usr/bin/php74 line into your ~/.bashrc file. This solution is persistent and user-wide.
You can put the PHP_PEAR_PHP_BIN=/usr/bin/php74 line into your /etc/environment file. This solution is persistent and system-wide.
You can put the export PHP_PEAR_PHP_BIN=/usr/bin/php74 line into /etc/profile.d/my_php_pear_solution.sh file. This solution is persistent and system-wide.
You can create a /usr/local/bin/my-pear (assuming that /usr/local/bin is in your $PATH) which handles this; given it one of - or all - the 3 executable bit and finally use the my-pear CLI instead of the official pear one. This solution is persistent and system-wide.
#!/usr/bin/env bash
# Set the location of our PHP binary.
export PHP_PEAR_PHP_BIN=/usr/bin/php74
# Start pear.
/usr/bin/pear ${#}
All of those may work. It's just a matter of scope, usability, and permission - somehow.
I hope this helps. Don't be afraid to ask if something is not clear.
P.S.: Welcome around here :-)
I'm trying to get access to rename_function in PHP, and for that I need PECL APD. I'm running Ubuntu 14.04 LTS.
I'm trying to run sudo pecl install apd, but I'm getting:
downloading apd-1.0.1.tgz ...
Starting to download apd-1.0.1.tgz (36,643 bytes)
..........done: 36,643 bytes
15 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of
the module
If the command failed with 'phpize: not found' then you need to install php5-dev package. You can do it by running 'apt-get install php5-dev' as a root userERROR: `phpize' failed
Should I be running this command from a certain directory?
This time I tried it with verbose options turned on, in case there is a clue in the logs:
sudo /usr/bin/pecl -vvvvv install apd
Warning: file_exists(): Unable to find the wrapper "channel" - did you forget to enable it when you configured PHP? in PEAR/Downloader/Package.php on line 1518
Warning: is_file(): Unable to find the wrapper "channel" - did you forget to enable it when you configured PHP? in PEAR/Downloader/Package.php on line 1528
Warning: is_file(): Unable to find the wrapper "channel" - did you forget to enable it when you configured PHP? in PEAR/Downloader/Package.php on line 1528
Downloading "http://pecl.php.net/get/apd-1.0.1.tgz"
downloading apd-1.0.1.tgz ...
Starting to download apd-1.0.1.tgz (36,643 bytes)
..........done: 36,643 bytes
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/LICENSE /usr/share/php/doc/apd/.tmpLICENSE
adding to transaction: chmod 664 /usr/share/php/doc/apd/.tmpLICENSE
adding to transaction: rename /usr/share/php/doc/apd/.tmpLICENSE /usr/share/php/doc/apd/LICENSE
adding to transaction: installed_as LICENSE /usr/share/php/doc/apd/LICENSE /usr/share/php/doc /apd
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/README /usr/share/php/doc/apd/.tmpREADME
adding to transaction: chmod 664 /usr/share/php/doc/apd/.tmpREADME
adding to transaction: rename /usr/share/php/doc/apd/.tmpREADME /usr/share/php/doc/apd/README
adding to transaction: installed_as README /usr/share/php/doc/apd/README /usr/share/php/doc /apd
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/pprofp /usr/bin/.tmppprofp
+ chmod +x /usr/bin/.tmppprofp
adding to transaction: chmod 775 /usr/bin/.tmppprofp
adding to transaction: rename /usr/bin/.tmppprofp /usr/bin/pprofp
adding to transaction: installed_as pprofp /usr/bin/pprofp /usr/bin /
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/pprof2calltree /usr/bin/.tmppprof2calltree
+ chmod +x /usr/bin/.tmppprof2calltree
adding to transaction: chmod 775 /usr/bin/.tmppprof2calltree
adding to transaction: rename /usr/bin/.tmppprof2calltree /usr/bin/pprof2calltree
adding to transaction: installed_as pprof2calltree /usr/bin/pprof2calltree /usr/bin /
15 source files, building
building in /tmp/pear/temp/pearf7LGca
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
If the command failed with 'phpize: not found' then you need to install php5-dev packageYou can do it by running 'apt-get install php5-dev' as a root userrolling back 12 file operations
+ rm /usr/share/php/doc/apd/.tmpLICENSE
+ rm /usr/share/php/doc/apd/.tmpREADME
+ rm /usr/bin/.tmppprofp
+ rm /usr/bin/.tmppprof2calltree
ERROR: `phpize' failed
Warning: unlink(/tmp/glibctestRdKE0K): No such file or directory in System.php on line 214
Warning: unlink(/tmp/pear/temp/pearf7LGca): No such file or directory in System.php on line 214
This will be a short summary of everything to is a precondition to run APD as a PHP profiler, I hope it will help your needs. This summary applies for PHP 5.6.2 APD 1.0.1 and might be incorrect for other versions.
First of all do not start it if you didn't ensure these two:
Deactivate Zend platform or any other PHP optimizer. In general you need to disable all Zend extensions.
Install a debugging enabled version of PHP (--enable-debug)
If you have a working PEAR setup you need to setup APD like in this article. Don't forget to try out distribution packages either. Otherwise APD's build as following:
Extract tarball.
Change directory in tarball.
Run <apache root>/bin/phpsize
Run ./configure (Add --with-php-config=<apache root>/bin/php-config if configure fails.)
Compile and install everything using
make
make install
Edit php.ini and add at least
zend_extension=/apd.so
apd.statement=1
apd.tracedir=/tmp/apd-traces
Create the output directory specified in php.ini
Now you'll need to restart Apache but before you do, check that the APD extension works fine. To do simply run PHP
/bin/php
No warning should be given if extension is loaded properly. If you get error message something like the "apd.so" extension couldn't be loaded there is a problem. Check if you compiled against the correct Apache/PHP version and using the same right now.
If PHP doesn't complain about anything enter:
<?php phpinfo(); ?>
and check for some lines about APD. If you find them you are done.
You'll also need some traces so to start tracing you need to your Apache to allow the PHP module to load APD. Next you'll need to identify the script to trace. Add the APD call at the top of the script:
apd_set_pprof_trace();
Then make some requests and remove the statement again to avoid causing further harm.
Now have a look at the trace directory. You should find files with a naming scheme of pprof[0-9]*.[0-9] here. Decode them using the pprofp tool from your APD source tarball. Example:
/bin/php /pprofp -u
Redirect stdout if necessary. Use -t instead of -u (summary output) to get calling trees. When you create traces with -t you get a summary output too, but it doesn't contain the per-call durations. I suggest to always create both a call tree and a summary trace.
Hope that helps, I recommend you hardly to read the link mentioned above.
EDIT:
The phpize command is meant to be run at the top level of an extension source dir (this source dir should contain a file name config.m4). See this for more info.
As per error:
If the command failed with phpize: not found then you need to install php5-dev package.
You can do it by running apt-get install php5-dev as a root user
I think you should install module development for PHP via:
sudo apt-get install php5-dev
This should provide you with phpize binary necessary to compile the Pecl extension sources. And make sure it's in your PATH.
I'm having trouble installing IonCube Loader on my Amazon Linux x64 instance.
I'm following these instructions below but the paths are way off and I can't seem to locate the right ones on my install.
For x64:
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz
Proceed as follows:
cp ioncube/ioncube_loader_lin_5.3.so /usr/lib/php5/20090626/ioncube.so
Now edit to match:
zend_extension = /usr/lib/php5/20090626/ioncube.so
nano /etc/php5/conf.d/ioncube.ini
First, there is no /usr/lib/php5/20090626/ folder. I changed these paths to /usr/lib64/php/modules and included the .so file in there.
However, I cannot seem to locate any ioncube.ini file to edit. Any help is appreciated...
Thank you!
For future readers sake, there is a difference between Amazon's Linux and other versions that most articles online refer to.
You can follow the first two steps above to get the installer, I like to use a temporary folder. Do this as root:
sudo -i
cd /tmp
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz
Copy the required extension to a slightly different folder under EC2 linux instances, and the loader wizard to your webroot:
cp ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules/ioncube.so
Create your ini file:
echo "zend_extension=/usr/lib64/php/modules/ioncube.so" > /etc/php.d/ioncube.ini
Reload Apache (if you're using it):
service httpd restart
I'm using NGINX and PHP-FPM, in this case you'd probably want to restart PHP-FPM as well as NGINX.
Lastly, use the loader wizard to test it by navigating to http://example.com/loader-wizard.php, and delete the temp files and loader wizard when finished:
rm -rf /tmp/ioncube*
rm /var/www/html/loader-wizard.php
I followed the instructions provided here in the first answer, making allowance for the fact that I'm runnning PHP 5.6:
sudo cp ioncube_loader_lin_5.6.so /usr/lib64/php/5.6/modules/ioncube.so
echo "zend_extension=/usr/lib64/php/5.6/modules/ioncube.so" > /etc/php.d/ioncube.ini
However, when restarting Apache, I found that it started then failed immediately. The Apache log gave me this error:
PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0
I changed the name of the file from ioncube.so to 00-ioncube.so and restarted Apache. This solved the problem by making this file load before the other modules.
Max OS X 10.7.. when i run phing -v i get the following errors:
Warning: require_once(phing/Project.php): failed to open stream: No such file or directory in /usr/lib/php/pear/phing/Phing.php on line 22
Fatal error: require_once(): Failed opening required 'phing/Project.php' (include_path='.:') in /usr/lib/php/pear/phing/Phing.php on line 22
Here are the commands i used:
pear config-set auto_discover 1
pear install phing/phing
Here is my php.ini:
include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php"
running whereis for php, pear, and phing returns:
bash-3.2$ whereis php
/usr/bin/php
bash-3.2$ whereis pear
/usr/bin/pear
bash-3.2$ whereis phing
/usr/bin/phing
running config-get for pear returns:
→ pear config-get php_dir
/usr/lib/php/pear
checking this folder, system.php and phing.php both exist in this path.
Seems like include_path is somehow broken.
Check PEAR's directory:
pear config-get php_dir
/usr/lib/php
Whatever directory is returned, it should contain PEAR files (System.php and phing files in particular)
Check that correct php.ini is used:
Run php --ini and see what INI file is being loaded. Then make sure this INI files contains PEAR directory in it's include_path
Check include_path:
Run php -c /path/to/php.ini -r 'echo get_include_path() . "\n";'.
Update
The problem is indeed with include_path since the error message reports (include_path='.:') which clearly shows that PEAR is NOT in your include path. This means that wrong php.ini is being loaded for CLI PHP. To fix it, find correct php.ini file (step 2) and add
include_path = ".:/usr/lib/php/pear"
to it.
I solve it simple ...
i'm configuring my /etc/paths to include propel generator on my path ambient.
then i add /Application/XAMPP/bin and /Application/XAMPP/Propel/generator/bin
i was getting that include error. Mac system comes with php preinstalled ... so, propel generator was getting wrong php installation.
I solve it simple ... i just changed the order of /etc/paths folders ...
as you see my /etc/paths file:
/Applications/XAMPP/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/Applications/XAMPP/Propel/generator/bin
Just Want to add one more easier solution for mac LION users (those who install stuff via macport ) , might work for leopard too
download this script anywhere, doesn't matter where it is
curl http://pear.php.net/go-pear.phar > go-pear.phar
run this command
sudo php -q go-pear.phar
it will ask you the paths, you shouldn't need to change it, but just check these paths contains any pear related files.
it will ask you if you want to update php.ini for you with these includes path [Y]
you are done! type phing and you should ask for your build.xml
Or if you don't have access to the server, you can do this:
$root = $SERVER['DOCUMENT_ROOT'];
It'll always reference the root of your project, and you can then reference the folder/file from that.
You don't have to touch the server if done that way.