Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 06-09-2009, 03:54 PM   #1
LQ Newbie
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
Linux Bash-PHP CLI error (path?)

I am running a PHP script on a Linux server from the command line as root. Using the exec("") command in PHP to execute some imagemagick stuff. ie exec("/usr/bin/tiff2ps -h 8.5 -w 11 /var/www/vhosts/*.tif");

If I do this exact command outside the PHP script (w/o php exec from bash), it works perfectly.

But if I execute the PHP script from bash (root) I am getting the error "sh: /tiff2ps: No such file or directory" - I have checked and the file is there and it is chmod 777.

Is this a path issue? Any ideas on how to fix?
Old 06-11-2009, 02:55 AM   #2
Senior Member
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,506

Rep: Reputation: 100Reputation: 100
I ran into something like this once when writing a PHP script that must FTP certain files to another server at cron-determined intervals. Are you using absolute paths? You'll probably have to...

I. e. when developing the script I ran it in a browser, for testing and design. But, when I deployed it on the actual server, it simply didn't work. It turned out I had to specify all path & file references in absolute terms, i. e.


had to become


Only once I used these absolute paths, did the script run correctly when called by cron...

So you might try using absolute paths in your exec() calls?

Last edited by rylan76; 06-11-2009 at 03:05 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 06:48 PM
php cli can't run php file outside its path asiandude Programming 4 12-11-2008 03:50 PM
CLI how to change Return-Path in mail donnied Linux - Newbie 2 08-22-2008 06:10 PM
Linux Path Lookup: php where command jCash Linux - Newbie 1 04-15-2007 06:24 PM
make: *** [sapi/cli/php] Error 1 hadiseh Linux - Software 4 12-13-2005 07:02 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration