Re: Re: [PHP] exec() Error
use wget exec(wget http://www.mysite.com/calculate.php;); Only execute the php programe from web exec(/usr/bin/php /.../calculate.php) 2008/6/27 Boyd, Todd M. [EMAIL PROTECTED]: -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2008 7:50 AM To: Boyd, Todd M.; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error Hi, Todd: It looks like I have some other errors in my Perl code, and I got it fixed, switched the permission to 755, and made attempts to call it using cURL through my working PHP script. Here is the code: // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, http://192.168.10.63/total.cgi;); curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); This time, I do not get the script output from the script in total.cgi, but I got Forbidden You don't have permission to access /total.cgi on this server. I have switched the permission to both scripts at both servers. Is there something wrong I have done here? Alice, I do not program in Perl, nor do I use CGI often enough to help you much here. However, it looks to me like it's a webserver issue, and has nothing to do with your code itself. Whatever CGI module is being used must probably be told that total.cgi needs granular permissions. Your web administrator will be able to help you much more than I can at this point. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 潘治岐 手机: 13621265301 Email: [EMAIL PROTECTED] MSN: [EMAIL PROTECTED]
RE: Re: [PHP] exec() Error
-Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2008 7:50 AM To: Boyd, Todd M.; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error Hi, Todd: It looks like I have some other errors in my Perl code, and I got it fixed, switched the permission to 755, and made attempts to call it using cURL through my working PHP script. Here is the code: // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, http://192.168.10.63/total.cgi;); curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); This time, I do not get the script output from the script in total.cgi, but I got Forbidden You don't have permission to access /total.cgi on this server. I have switched the permission to both scripts at both servers. Is there something wrong I have done here? Alice, I do not program in Perl, nor do I use CGI often enough to help you much here. However, it looks to me like it's a webserver issue, and has nothing to do with your code itself. Whatever CGI module is being used must probably be told that total.cgi needs granular permissions. Your web administrator will be able to help you much more than I can at this point. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] exec() Error
Boyd, Todd M. wrote: Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. That's not what Alice asked for though. She did mention that a remote call would be made somewhere, but her question was: Has anyone tried using exec() successfully in PHP to execute files from PHP or other programming languages? For example, C, Python, or Perl. And that works just fine using exec(). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] exec() Error
Hi, Todd: It looks like I have some other errors in my Perl code, and I got it fixed, switched the permission to 755, and made attempts to call it using cURL through my working PHP script. Here is the code: // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, http://192.168.10.63/total.cgi;); curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); This time, I do not get the script output from the script in total.cgi, but I got Forbidden You don't have permission to access /total.cgi on this server. I have switched the permission to both scripts at both servers. Is there something wrong I have done here? Thanks again for your help. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Boyd, Todd M. [EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 5:07 PM To: Wei, Alice J.; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 3:31 PM To: Boyd, Todd M.; Per Jessen; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error ---8--- snip Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. Perhaps doing a wget and directing it to /dev/null (if you're on *nix) would be appropriate to invoke a remote script and pass it parameters. Hell, even wget to standard output if you want, and use that as your result code. It's basically doing what cURL does, but outside of the PHP script itself. Anyway, I digress. My point is that exec(php http://mysite.com/script.php;) will fail, since it will be reading the remote script's OUTPUT, and not the remote script's SOURCE CODE. I dont' know how come his code works either. I figured that exec() is not going to get me anywhere when I have it stored remotely. I am now using cURL instead of using exec(), since it is doing a lot closer to what I initiated. I am not sure if I should have a new thread for this, but I found that things start to get a little weird when I tried to do cURL with Perl files inside. The PHP only brings me back Perl code and not the processed content. Is this something I should not be doing with cURL? It seems to do quite a bit of powerful processing when I wrote everything in PHP and have it stored remotely. Alice, If it's returning the code instead of the processed content, then it means that the webserver which houses the Perl script is not executing/parsing it. You should check with the administrator of the remote webserver to see if they have a Perl module installed, and if it is configured properly for your web app. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: Re: [PHP] exec() Error
-Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2008 1:11 AM To: php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error Boyd, Todd M. wrote: Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. That's not what Alice asked for though. She did mention that a remote call would be made somewhere, but her question was: Has anyone tried using exec() successfully in PHP to execute files from PHP or other programming languages? For example, C, Python, or Perl. And that works just fine using exec(). Well... if she was trying to execute *LOCAL* PHP code from within a PHP script that was already running (which she was not), why would you suggest that she use exec() instead of include()? I think the issue has been obfuscated. Nevertheless, she's on the right track to making her program do what she wants to. Win-win. Todd Boyd Web Programmer
RE: RE: Re: [PHP] exec() Error
Boyd, Todd M. wrote: PHP or other programming languages? For example, C, Python, or Perl. And that works just fine using exec(). Well... if she was trying to execute *LOCAL* PHP code from within a PHP script that was already running (which she was not), why would you suggest that she use exec() instead of include()? If she'd only asked about PHP, include() would be the answer, but she also included C and Perl in the options. I think the issue has been obfuscated. Nevertheless, she's on the right track to making her program do what she wants to. Yup. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] exec() Error
Alice, If you are already set 755 on the CGI, it looks like it might be a webserver configuration issue. If you are using Apache (I'm assuming you are) you might want to take a look at http://httpd.apache.org/docs/2.0/howto/cgi.html#configuringapachetopermitcgi for some hints on how to make sure that the server configuration is proper for using CGI scripts. Regards Jason On Thu, Jun 26, 2008 at 8:50 AM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, Todd: It looks like I have some other errors in my Perl code, and I got it fixed, switched the permission to 755, and made attempts to call it using cURL through my working PHP script. Here is the code: // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, http://192.168.10.63/total.cgi;); curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); This time, I do not get the script output from the script in total.cgi, but I got Forbidden You don't have permission to access /total.cgi on this server. I have switched the permission to both scripts at both servers. Is there something wrong I have done here? Thanks again for your help. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Boyd, Todd M. [EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 5:07 PM To: Wei, Alice J.; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 3:31 PM To: Boyd, Todd M.; Per Jessen; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error ---8--- snip Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. Perhaps doing a wget and directing it to /dev/null (if you're on *nix) would be appropriate to invoke a remote script and pass it parameters. Hell, even wget to standard output if you want, and use that as your result code. It's basically doing what cURL does, but outside of the PHP script itself. Anyway, I digress. My point is that exec(php http://mysite.com/script.php;) will fail, since it will be reading the remote script's OUTPUT, and not the remote script's SOURCE CODE. I dont' know how come his code works either. I figured that exec() is not going to get me anywhere when I have it stored remotely. I am now using cURL instead of using exec(), since it is doing a lot closer to what I initiated. I am not sure if I should have a new thread for this, but I found that things start to get a little weird when I tried to do cURL with Perl files inside. The PHP only brings me back Perl code and not the processed content. Is this something I should not be doing with cURL? It seems to do quite a bit of powerful processing when I wrote everything in PHP and have it stored remotely. Alice, If it's returning the code instead of the processed content, then it means that the webserver which houses the Perl script is not executing/parsing it. You should check with the administrator of the remote webserver to see if they have a Perl module installed, and if it is configured properly for your web app. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec() Error
Wei, Alice J. wrote: I have got a task from my client asking me to build something that allows the variables in the PHP file passed to another PHP file or a file in a different computer language to perform some operations on another remote machine. According to my client, he calls this behind the scenes to avoid users screw up the front end, and I am hoping that I can produce one single script, and have it execute some script without the user pushing any button. Has anyone tried using exec() successfully in PHP to execute files from PHP or other programming languages? For example, C, Python, or Perl. Yeah, that's no big deal. That's what exec() does. I have tried this by putting in exec(http://www.mysite.com/calculate.php;); Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] exec() Error
___ From: Per Jessen [EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 3:47 PM To: php-general@lists.php.net Subject: Re: [PHP] exec() Error Wei, Alice J. wrote: I have got a task from my client asking me to build something that allows the variables in the PHP file passed to another PHP file or a file in a different computer language to perform some operations on another remote machine. According to my client, he calls this behind the scenes to avoid users screw up the front end, and I am hoping that I can produce one single script, and have it execute some script without the user pushing any button. Has anyone tried using exec() successfully in PHP to execute files from PHP or other programming languages? For example, C, Python, or Perl. Yeah, that's no big deal. That's what exec() does. I have tried this by putting in exec(http://www.mysite.com/calculate.php;); Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I just found out that using cURL in my script allows me to call script from machine to machine. It turned out perfectly. Thanks to all who have been helping me with this! Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] exec() Error
-Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 2:48 PM To: php-general@lists.php.net Subject: Re: [PHP] exec() Error Wei, Alice J. wrote: I have got a task from my client asking me to build something that allows the variables in the PHP file passed to another PHP file or a file in a different computer language to perform some operations on another remote machine. According to my client, he calls this behind the scenes to avoid users screw up the front end, and I am hoping that I can produce one single script, and have it execute some script without the user pushing any button. Has anyone tried using exec() successfully in PHP to execute files from PHP or other programming languages? For example, C, Python, or Perl. Yeah, that's no big deal. That's what exec() does. I have tried this by putting in exec(http://www.mysite.com/calculate.php;); Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. Perhaps doing a wget and directing it to /dev/null (if you're on *nix) would be appropriate to invoke a remote script and pass it parameters. Hell, even wget to standard output if you want, and use that as your result code. It's basically doing what cURL does, but outside of the PHP script itself. Anyway, I digress. My point is that exec(php http://mysite.com/script.php;) will fail, since it will be reading the remote script's OUTPUT, and not the remote script's SOURCE CODE. HTH, Todd Boyd Web Programmer
RE: Re: [PHP] exec() Error
From: Boyd, Todd M. [EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 4:25 PM To: Per Jessen; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error -Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 2:48 PM To: php-general@lists.php.net Subject: Re: [PHP] exec() Error Wei, Alice J. wrote: I have got a task from my client asking me to build something that allows the variables in the PHP file passed to another PHP file or a file in a different computer language to perform some operations on another remote machine. According to my client, he calls this behind the scenes to avoid users screw up the front end, and I am hoping that I can produce one single script, and have it execute some script without the user pushing any button. Has anyone tried using exec() successfully in PHP to execute files from PHP or other programming languages? For example, C, Python, or Perl. Yeah, that's no big deal. That's what exec() does. I have tried this by putting in exec(http://www.mysite.com/calculate.php;); Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. Perhaps doing a wget and directing it to /dev/null (if you're on *nix) would be appropriate to invoke a remote script and pass it parameters. Hell, even wget to standard output if you want, and use that as your result code. It's basically doing what cURL does, but outside of the PHP script itself. Anyway, I digress. My point is that exec(php http://mysite.com/script.php;) will fail, since it will be reading the remote script's OUTPUT, and not the remote script's SOURCE CODE. I dont' know how come his code works either. I figured that exec() is not going to get me anywhere when I have it stored remotely. I am now using cURL instead of using exec(), since it is doing a lot closer to what I initiated. I am not sure if I should have a new thread for this, but I found that things start to get a little weird when I tried to do cURL with Perl files inside. The PHP only brings me back Perl code and not the processed content. Is this something I should not be doing with cURL? It seems to do quite a bit of powerful processing when I wrote everything in PHP and have it stored remotely. Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] exec() Error
-Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 3:31 PM To: Boyd, Todd M.; Per Jessen; php-general@lists.php.net Subject: RE: Re: [PHP] exec() Error ---8--- snip Well, http://www.mysite.com/calculate.php; is not an executable. Try this instead: exec(php path/calculate.php); I still don't think this is how exec() should be used when executing remote PHP scripts via HTTP, since the web server is not going to give you the underlying code simply because you're calling the URL from PHP and not your web browser. User-Agent tags do not a secure connection make. Perhaps doing a wget and directing it to /dev/null (if you're on *nix) would be appropriate to invoke a remote script and pass it parameters. Hell, even wget to standard output if you want, and use that as your result code. It's basically doing what cURL does, but outside of the PHP script itself. Anyway, I digress. My point is that exec(php http://mysite.com/script.php;) will fail, since it will be reading the remote script's OUTPUT, and not the remote script's SOURCE CODE. I dont' know how come his code works either. I figured that exec() is not going to get me anywhere when I have it stored remotely. I am now using cURL instead of using exec(), since it is doing a lot closer to what I initiated. I am not sure if I should have a new thread for this, but I found that things start to get a little weird when I tried to do cURL with Perl files inside. The PHP only brings me back Perl code and not the processed content. Is this something I should not be doing with cURL? It seems to do quite a bit of powerful processing when I wrote everything in PHP and have it stored remotely. Alice, If it's returning the code instead of the processed content, then it means that the webserver which houses the Perl script is not executing/parsing it. You should check with the administrator of the remote webserver to see if they have a Perl module installed, and if it is configured properly for your web app. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php