cannot get phing to run at all - php

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.

Related

"Cannot find config.m4." while running phpize in the installation of apd using pecl

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.

Can't find the go-pear.bat file PHP 5.5 Windows 7

The command from their documentation says to run the command:
C:\php>php go-pear.phar
Could not open input file: go-pear.phar
According to Installation Documents the go-pear.bat file should be located in the root of the php files (c:\php). I have downloaded php-5.5.9-Win32-VC11-x64 to go with my x64 version of Apache 2.4
The closest thing I have to this is: phar.phar.bat.
When trying to run this I get the following:
C:\php>"C:\php\php.exe" "C:\php\pharcommand.phar"
No command given, check C:\php\pharcommand.phar help
or
C:\php>php phar.phar.bat
"%~dp0php.exe" "%~dp0pharcommand.phar" %*
if you can't find the go-pear.bat file, try with the go-pear.phar
you must to download it on the PEAR website. after that, place it in this folder according your apache server configuration "C:\wamp\bin\php\php5.5.12"
Did you save go-pear.phar to C:\php\ ? If php is working fine then you should be able to just cd to the directory where you saved the go-pear.phar file and do
$ php go-pear.phar

Installing phpDocumentor via PEAR, "command not found"

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.

sudo: pear: command not found

I have snow leopard which apparently has php with pear pre-installed. I enabled php but could not find any signs of PEAR. So I have installed it and now phpinfo() shows its installation
include_path .:/usr/lib/php/share/pear
Still when I type in any pear command
$ sudo pear
I get an error: sudo: pear: command not found
What am I missing?
Many ways to skin this cat, but I would type this if you have locate installed (which you probably do):
$ locate bin/pear
That should list one or more things, one of which will look like the path to pear. Let's say it says something like /usr/local/bin/pear. Then your next command is:
$ sudo /usr/local/bin/pear
Two caveats come to mind:
It's possible that locate will list multiple executable pear files. If that's the case, it may be important to pick the right one based on which PHP you're using.
You may want to add the directory where pear is located to your PATH environment variable.
You need to update your system $PATH variable in order for the pear command to work. Edit the bash profile file using the following(if you have textmate):
mate ~/.bash_profile
and add in this line:
export PATH=/usr/local/pear/bin:$PATH
reload your terminal after that and it should work now
Edited:
Thanks for highlighting my mistake trott. I have changed the path to locate where the bin should roughly be(depending on where one chooses to install it)
If you have installed pear directly on PHP (MAMP, for example) you should copy pear to /usr/local/bin:
cp /php5.3.2/pear /usr/local/bin/pear
then export var PATH, and test with "pear" in the shell.
I had a similar issue and required updating secure_path in sudoers as it overrides user's $PATH.
Check for secure_path on sudo
[root#host ~]# sudo -V | grep 'Value to override'
Value to override user's $PATH with: /sbin:/bin:/usr/sbin:/usr/bin
If $PATH is being overriden us visudo and edit /etc/sudoers
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

PEAR directory problem on Windows

I've downloaded the ZIP archive of PHP and extracted it under my profile. I then needed some PEAR packages. go-pear.bat apparently installed PEAR just fine, I just needed to go into the pear.bat file afterwards and adapt the path to php.exe – no big deal and after that it ran.
However, when I try installing something I get the following error:
ERROR: failed to mkdir C:\php5\pear\data\Console_CommandLine\data
Naturally, no write access is allowed in the root directory but I'm a little at a loss to know how exactly PEAR thinks it should install anything in a location that neither exists nor is configured anywhere. PHP currently resides somewhere below H:\ (subst'ed to my profile). All paths I entered during PEAR installation were sane and the only place I can find C:\php5 is in PEAR/go-pear.phar and in the documentation. One of those is something I shouldn't change anyway, I guess and the other thing is hardly relevant for the program itself.
Now, I probably could go in and make C:\php5 a junction/symlink to the directory where PHP lies currently or actually install it in that location – both things I'd rather avoid since this was originally just intended for a little test of something.
I since looked into pear help install and apparently I can use -P or -R so set some paths. The exact difference between those is still unclear to me but it won't hurt to try them, I guess. Somehow the results were ... unexpected:
-P H:\Downloads\php\PEAR resulted in the fun error (among others)
ERROR: failed to mkdir C:\Downloads\php\PEAR\php5\pear\data\Console_CommandLine\data
while -R using the same path (apparently -R dictates where downloads are stored, since that worked before I guess I shouldn't touch this) resulted in even more fun:
download directory "C:\Downloads\php\PEAR\Users\JOHANN~1\AppData\Local\Temp\pear\download" is not writeable. Change download_dir config variable to a writeable dir
By now I guess both C:\ and php5 are somewhere hardcoded for no apparent reason (my environment variables also contain nothing of that sort) so I'll go digging again, this time looking for shorter string and therefore longer result lists.
But if anyone has an idea about this in the meantime, this might be helpful.
The problem is that PEAR looks for its ini file in the Windows directory, and because it doesn't find it there, it resorts to guessing the location. Even worse, you can't change any configuration settings with pear config-set because PEAR doesn't have a pear.ini to write to. At the same time, PEAR ignores an existing pear.ini file in its own directory. It's a mess. See this bug report.
If there is just one global PEAR install, PEAR can be told where to look for an ini file by creating an environment variable, PHP_PEAR_SYSCONF_DIR, pointing to the right directory.
But if there are multiple, local PEAR installs, you'll have to patch pear.bat by adding this line:
IF "%PHP_PEAR_SYSCONF_DIR%"=="" SET "PHP_PEAR_SYSCONF_DIR=C:\path\to\pear.ini\directory"
A slightly better option than michael h's answer might be:
Open $prefix\pear\PEAR\Config.php where $prefix is the value used in the PEAR installer. (On my Windows system, $prefix was C:\php\5.4.0)
Find the section below:
if (getenv('PHP_PEAR_SYSCONF_DIR')) {
define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR'));
} elseif (getenv('SystemRoot')) {
define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot'));
} else {
define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
}
And make the following changes:
if (getenv('PHP_PEAR_SYSCONF_DIR')) {
define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR'));
//} elseif (getenv('SystemRoot')) {
//define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot'));
} else {
//define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
// This next line is new
define('PEAR_CONFIG_SYSCONFDIR', $PEAR_INSTALL_DIR);
}
This solution is less hazard-prone when dealing with multiple PHP/PEAR versions/installations, especially when running more than one at the same time, as you avoid environment clobbering.
Apparently the PEAR developers overlooked the fact that WINDOWS, Program Files and friends have been deprecated as application-data directories since Windows Vista, and are generally no longer writable by non-elevated applications. (For good security reasons.)
Look at the config-... parameters of the PEAR command:
config-create Create a Default configuration file
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
I presume C:\php5 is the builtin default directory when you don't set another one.
you can specify the config file via
pear -c /path/to/config/file $command
I've had the same problem. My config file was missing from the C:\Windows directory - there is definitely something wrong with the go-pear installer - I specified a different INI file location, yet my wish has not come true.
I copied pear.ini to C:\windows and everything started to work.
If your PHP installation has been done somewhere else other than the C:\ drive, then “pear install” command may throw errors.
Example: Here in my case, the xampp has been installed into E:\ drive and the “pear install” throws error.
Error got when I run the command. This also happen for PHPDocumentor
Solution:
I get into the “pear” directory and checked config values set for different pear related directories. All were set to C:\ drive by default. So, we need to change those settings to correct path.
Open the command prompt in "Run as administrator" mode.
Pear default setting
Now change five path in xampp like this
E:\xampp\php>
E:\xampp\php>pear config-set doc_dir E:\xampp\php\pear
If you are using C drive and getting the same error then also the above statement will remain same just replace the drive name E:\ to C:\ vice versa.
example for C: drive
C:\xampp\php>pear config-set doc_dir C:\xampp\php\pear
Then press enter it will display a msg of config-set succeeded
Like this you have to enter 5 commands.
E:\xampp\php>pear config-set doc_dir E:\xampp\php\pear
config-set succeeded
E:\xampp\php>pear config-set cfg_dir E:\xampp\php\pear
config-set succeeded
E:\xampp\php>pear config-set data_dir E:\xampp\php\pear
config-set succeeded
E:\xampp\php>pear config-set test_dir E:\xampp\php\pear
config-set succeeded
E:\xampp\php>pear config-set www_dir E:\xampp\php\pear
config-set succeeded
Finally installed pear

Categories