Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13085

Re: php exec http url

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: php exec http url
Date 2014-03-07 18:12 +0000
Organization A noiseless patient Spider
Message-ID <lfd26l$s4c$1@dont-email.me> (permalink)
References <5573acd6-1217-446d-989d-67b2807e5075@googlegroups.com>

Show all headers | View raw


On Thu, 06 Mar 2014 12:42:52 -0800, bishop2001 wrote:

> Greetings,
> I am trying to execute a shell script which is residing on a webserver
> on a remote machine with no luck. I have tried the following. It looks
> like it runs but I never see the output from the script on machine2. Any
> suggestions. Thanks,

Firstly, you say "It looks like it runs"

What evidence do you have for this?

> from machine 1:
> echo exec('http://machine2/script.sh);

What entries appear in the webserver logs on the server after attempting 
this? You probably want to check any log file in the apache logs dir that 
has it's timestamp modified when you try and access the script.

> from machine1:
> <?php $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, "http://machine2/script.sh");
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_exec($ch);
> curl_close($ch);
> ?>

What entries appear in the webserver logs on the server after attempting 
this?

Are you sure that the webserver is configured to run .sh files as shell 
scripts and pipe the output of the script back to the http session?

Are you sure that the script is executable by the webserver process? 
Execute permissions for relevant users / groups / world?

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

php exec http url bishop2001 <lancerset@gmail.com> - 2014-03-06 12:42 -0800
  Re: php exec http url Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-06 16:04 -0500
  Re: php exec http url Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-07 15:09 +0100
    Re: php exec http url The Natural Philosopher <tnp@invalid.invalid> - 2014-03-07 14:55 +0000
      Re: php exec http url Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-07 16:36 +0100
        Re: php exec http url The Natural Philosopher <tnp@invalid.invalid> - 2014-03-07 20:33 +0000
  Re: php exec http url Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-07 18:12 +0000

csiph-web