LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-09-2009, 02:54 PM   #1
superportal
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/mysite.com/pdf/*.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, 01:55 AM   #2
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
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.

/backupfiles/backupfile.tar.7z

had to become

/usr/www/fwuser/public_html/backupfiles/backupfile.tar.7z

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 02:05 AM.
 
  


Reply


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 05:48 PM
php cli can't run php file outside its path asiandude Programming 4 12-11-2008 02:50 PM
CLI how to change Return-Path in mail donnied Linux - Newbie 2 08-22-2008 05:10 PM
Linux Path Lookup: php where command jCash Linux - Newbie 1 04-15-2007 05:24 PM
make: *** [sapi/cli/php] Error 1 hadiseh Linux - Software 4 12-13-2005 06:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:11 PM.

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