You are here: CLI: unable to exec shell commands « PHP « IT news, forums, messages
CLI: unable to exec shell commands

Posted by Andy Pieters on 05/28/05 22:42

Hi all

I have several scripts that stoped working. All those scripts have in common
that they call shell commands.

To find out what was going on, I did a little test
cat << "?>" | php
<?php
echo "exec test\n";
exec("dir",$output,$errs);
?>
exec test
sh: /usr/local/php/bin/dir: No such file or directory

As you can see it is trying to call sh with a weird path. It should
use /usr/bin/dir instead

Also when I try it with 'type' (which is an internal command) it has the same
result.

I recently switched from FC3 to FC4 for my development. The PHP binary I'm
using was compiled from sources with the following charasteristics:


PHP Version => 4.3.10

Configure Command => './configure' '--prefix=/usr/local/bin'
'--bindir=/usr/bin' '--with-mysql' '--with-config-file-path=/etc'
'--enable-mbstring' '--enable-mbregex' '--with-gd' '--enable-gd-native-ttf'
'--with-ttf-dir=/usr/bin' '--with-freetype-dir=/usr/lib'
'--with-png-dir=/usr/lib' '--with-xpm-dir=/usr/X11R6' '--enable-ftp'
'--enable-memory-limit' '--enable-safe-mode' '--enable-bcmath'
'--enable-calendar' '--enable-ctype' '--enable-inline-optimization'
'--with-bz2' '--with-iconv' '--with-zlib-dir=/usr/lib' '--disable-cgi'
'--with-cli'
Server API => Command Line Interface

Any ideas?


With kind regards


Andy

--
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>++++$@ h++(*) r-->++ y--()>++++
-- ---END GEEK CODE BLOCK------
--
Check out these few php utilities that I released
under the GPL2 and that are meant for use with a
php cli binary:

http://www.vlaamse-kern.com/sas/
--

--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация