Find the answer to your Linux question:
Results 1 to 3 of 3
Ok shoot me now. I have a php script that ran beautifully 5.0.4 but on my new server running 5.1.6 it won't run. I can't see any changes in the ...
  1. #1
    Just Joined!
    Join Date
    May 2004
    Location
    CO USA
    Posts
    5

    Where did my variables go in php -> exec?

    Ok shoot me now. I have a php script that ran beautifully 5.0.4 but on my new server running 5.1.6 it won't run. I can't see any changes in the php site as what the heck is the problem.

    Script is fired by a cron with user root
    /usr/bin/php -f shootmenow.php

    shootmenow.php uploads a file via scp as follows

    <?
    $myfile = "/home/me/". date("Ymd").".txt;

    exec("scp -o 'IdentityFile2 /home/id_rsa' ".$myfile." sftp_at_sftp_place.com]:");
    ?>

    I can echo the exec command and run from a command line as root in the same directory, but the script says "sorry no file to scp". It ignores the variable completely. Is there some security setting that won't let a variable sit in the exec now? This has me pulling my hair out, it worked great before. If I type the file name into the exec and don't use the variable, it works fine as well.

    Help me oh good coders,

    B

  2. #2
    Linux Enthusiast KenJackson's Avatar
    Join Date
    Jun 2006
    Location
    Maryland, USA
    Posts
    506
    My php experience is weak, so I won't comment on the code.

    But I had a similar experience recently on my site hosted at BlueHost.com when they upgraded PHP. I don't remember what version to what version. The solution that worked for me was to logon to their cPanel and click on PHP Config to reinstall the php.ini files.

  3. #3
    Just Joined!
    Join Date
    May 2004
    Location
    CO USA
    Posts
    5

    Unhappy Thanks but no fix

    I have restarted apache several times as I'm tweaking the vhosts on several sites here and rebooted the box as well.

    Its so confusing as I can echo the variable so I know its being set, and I can run the command with the value typed in, but the exec will not read the variable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...