RE: [PHP] Using php as a scripting language within cron jobs?
On Fri, 17 May 2002, Dan Hardiker wrote: >> from the cron I would call this command... >> >> wget -q -T10 http:/www.mydomain.com/myScript.php -0 /dev/null > > This makes it highly insecure as anyone could execute it (unless you > locked it down which is silly when you could just run it locally > yourself). Also the data is going over HTTP which would easily be > intercepted with ethereal / tcpdump etc. I still *strongly* recommend > compiling a binary if only for purely security based precautionary > reasons. Your point about the script being web-accessible is crucial and sufficient reason for not doing things that way. The tcpdump thing isn't much of a concern, because a connection to a local address will be shunted across lo0 (or whatever your loopback interface is called), and therefore can only be sniffed by someone with root access on that same machine. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
> from the cron I would call this command... > > wget -q -T10 http:/www.mydomain.com/myScript.php -0 /dev/null > > I have never had a problem with this method, although I am sure it has > a higher overhead than compiling as a binary and directly calling php. This method (again) is insecure in the extreme... please see my other responses to this for further details but basically, the following stand: 1. The script is executed as the web process 2. The web process has to be running 3. The script is accessable from the web This makes it highly insecure as anyone could execute it (unless you locked it down which is silly when you could just run it locally yourself). Also the data is going over HTTP which would easily be intercepted with ethereal / tcpdump etc. I still *strongly* recommend compiling a binary if only for purely security based precautionary reasons. -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
I personally have never come across the method that is involved in compiling PHP as a binary, but I have come up with a way to run PHP scripts from the Command Line and Cron without the binary. from the cron I would call this command... wget -q -T10 http:/www.mydomain.com/myScript.php -0 /dev/null I have never had a problem with this method, although I am sure it has a higher overhead than compiling as a binary and directly calling php. -Jared -Original Message- From: Henry Grech-Cini [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 6:12 AM To: [EMAIL PROTECTED] Subject: [PHP] Using php as a scripting language within cron jobs? Hi All, Is this possible? I really don't want to go back to perl5 to setup an autoresponder system! Henry -- 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: [PHP] Using php as a scripting language within cron jobs?
> #!/path.to/php -q > > I'd like to suggest the -q option for PHP shell scripts, which I rely > on every day. Sh!! We dont want to give away *everything* heh... bah ... well I might as well give you the rest of the info. [14:03:50][dhardiker@amnesiac]:~$ php -? Usage: php [-q] [-h] [-s [-v] [-i] [-f ] | { [args...]} -q Quiet-mode. Suppress HTTP Header output. -s Display colour syntax highlighted source. -f Parse . Implies `-q' -v Version number -C Do not chdir to the script's directory -c Look for php.ini file in this directory -a Run interactively -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -z Load Zend extension . -l Syntax check only (lint) -m Show compiled in modules -i PHP information -h This help [14:03:52][dhardiker@amnesiac]:~$ everything there is pretty self explanitory... as is the reason for using option q ;) -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
-q? this is for disabling the html headers, right? "James E. Hicks III" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > #!/path.to/php -q > > I'd like to suggest the -q option for PHP shell scripts, which I rely on every > day. > > James > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
#!/path.to/php -q I'd like to suggest the -q option for PHP shell scripts, which I rely on every day. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
>> > Set your cron job up as "lynx -dump >> > http://www.myserver.com/myscript.php /dev/null" >> > (or pipe it to a logfile if you fancy) - obviously, >> > you'll need lynx installed for this to work :-) >> >> but this is only needed only if you compile php into apache or am i >> wrong? if i have the cgi version installed, i can call the php script >> directly from the shell. The only thing for me to do then, is to set >> #!/path.to/php in the first line of the script, right? > > Spot on. As a couple of others have pointed out, you can compile PHP to > be a standalone interpreter and then write scripts for it - personally > I always use it as a module, and I find using lynx works perfectly... > if it ain't broken, don't fix it... Please be very very careful with this advice. I use PHP to shell script and can do some pretty dangerous stuff (eg: edit system configuration files and HUP daemons). If this script was exectuted via the web there could be 3 major issues: 1. Apache would have be live and working in order for the script to run. Not good if starting apache is what your intending!2. Security - its web accessable! You are going to have to bolt down your apache like a rat's ass to make sure no1 gets in to malioulsy execute your code. Even then theres no gaurentee that there will be no apache exploit to get around it.3. You might want the script performed as a certain user. With the cron and a binary your executing it as the cron owner... which is essential for editing files and HUPing processes that dont belong to the web process. If your execing PHP scripts from cron I highly recommend using the binary, if only for standalone purposes. It all depends what your after doing... experimentation is the key, and imho you should stick to the binary for shell stuff and the module for web stuff. -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
> the only thing that can smash th whole thing imo, is if > you try to use the cgi version > via web if you have php also installed as apache module. but all of > what i wrote is a guess, > never tried by myself. You can do all of the following simultaniously without and clashes: * Use PHP as an apache module * Use PHP as a cgi-binary via the web * Use PHP for shell scripting The first uses the module, the latter 2 use the binary created. They can also be created with 2 differnt configure statments. EG: you could have imap enabled in the apache module, but not in the binary... and you could have 3 binarys, one with sockets & pcntl enabled, one with dom & xml enabled, and one with everything enabled... etc. -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
>> [snip] >> > but this is only needed only if you compile php into apache or am i >> > wrong? if i have the cgi version installed, i can call the php >> > script directly from the shell. The only thing for me to do then, is >> > to set >> > #!/path.to/php in the first line of the script, right? >> [/snip] >> >> Can you have the compiled with apache version and the CGI version >> installed on the same server? > > Sure can! Yes... in your ./configure line, leave out the --with-apache and --with-apxs options. This will warn you that it is about to create a binary and not a module. After a make install it will usually end up in /usr/local/bin/php for you to use as your shell interpretor. (Follow up email regarding security to follow from a linx post). -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
[snip] Works well, and if your using libraries of code, you can share between the web module and the cgi. his is what I do, and sometimes I run a daemon to update a cache, so that the web module never needs to hang the user while it retrieves data from a remote site. [/snip] Too cool, I will start testing somethings today. I can see where this would be a terrific and scalable feature! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
Michael Virnstein wrote: > > afaik yes. > The module version should be called if apache has been requested with one of > the > reqistered php file types. the cgi version can be used as shell interpreter. > the only thing that can smash th whole thing imo, is if you try to use the > cgi version > via web if you have php also installed as apache module. but all of what i > wrote is a guess, > never tried by myself. Works well, and if your using libraries of code, you can share between the web module and the cgi. his is what I do, and sometimes I run a daemon to update a cache, so that the web module never needs to hang the user while it retrieves data from a remote site. Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
> the only thing that can smash th whole thing imo, is if you try to use the > cgi version via web if you have php also installed as apache module. if anyone has infos here, it'll be really nice. Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > afaik yes. > The module version should be called if apache has been requested with one of > the > reqistered php file types. the cgi version can be used as shell interpreter. > the only thing that can smash th whole thing imo, is if you try to use the > cgi version > via web if you have php also installed as apache module. but all of what i > wrote is a guess, > never tried by myself. > > Regards Michael > > > "Jay Blanchard" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt">news:000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt... > > [snip] > > > but this is only needed only if you compile php into apache or am i > wrong? > > > if i have the cgi version installed, i can call the php script > > > directly from the shell. The only thing for me to do then, is to set > > > #!/path.to/php in the first line of the script, right? > > [/snip] > > > > Can you have the compiled with apache version and the CGI version > installed > > on the same server? > > > > Thanks! > > > > Jay > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
afaik yes. The module version should be called if apache has been requested with one of the reqistered php file types. the cgi version can be used as shell interpreter. the only thing that can smash th whole thing imo, is if you try to use the cgi version via web if you have php also installed as apache module. but all of what i wrote is a guess, never tried by myself. Regards Michael "Jay Blanchard" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt">news:000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt... > [snip] > > but this is only needed only if you compile php into apache or am i wrong? > > if i have the cgi version installed, i can call the php script > > directly from the shell. The only thing for me to do then, is to set > > #!/path.to/php in the first line of the script, right? > [/snip] > > Can you have the compiled with apache version and the CGI version installed > on the same server? > > Thanks! > > Jay > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
Jay Blanchard wrote: > > [snip] > > but this is only needed only if you compile php into apache or am i wrong? > > if i have the cgi version installed, i can call the php script > > directly from the shell. The only thing for me to do then, is to set > > #!/path.to/php in the first line of the script, right? > [/snip] > > Can you have the compiled with apache version and the CGI version installed > on the same server? Sure can! Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
[snip] > but this is only needed only if you compile php into apache or am i wrong? > if i have the cgi version installed, i can call the php script > directly from the shell. The only thing for me to do then, is to set > #!/path.to/php in the first line of the script, right? [/snip] Can you have the compiled with apache version and the CGI version installed on the same server? Thanks! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
Hi Michael, > > Set your cron job up as "lynx -dump http://www.myserver.com/myscript.php > > > /dev/null" (or pipe it to a logfile if you fancy) - obviously, you'll need > > lynx installed for this to work :-) > > but this is only needed only if you compile php into apache or am i wrong? > if i have the cgi version installed, i can call the php script > directly from the shell. The only thing for me to do then, is to set > #!/path.to/php in the first line of the script, right? Spot on. As a couple of others have pointed out, you can compile PHP to be a standalone interpreter and then write scripts for it - personally I always use it as a module, and I find using lynx works perfectly... if it ain't broken, don't fix it... Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
correct... > -Original Message- > From: Michael Virnstein [mailto:[EMAIL PROTECTED]] > Sent: 17 May 2002 12:57 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Using php as a scripting language within cron jobs? > > > > Set your cron job up as "lynx -dump > http://www.myserver.com/myscript.php > > > /dev/null" (or pipe it to a logfile if you fancy) - > obviously, you'll need > > lynx installed for this to work :-) > > but this is only needed only if you compile php into apache > or am i wrong? > if i have the cgi version installed, i can call the php script > directly from the shell. The only thing for me to do then, is to set > #!/path.to/php in the first line of the script, right? > > Regards Michael > > "Jon Haworth" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 67DF9B67CEFAD4119E4200D0B720FA3F010C40D4@BOOTROS">news:67DF9B67CEFAD4119E4200D0B720FA3F010C40D4@BOOTROS... > > Hi Henry, > > > > > Is this possible? > > > > yup. > > > > Set your cron job up as "lynx -dump > http://www.myserver.com/myscript.php > > > /dev/null" (or pipe it to a logfile if you fancy) - > obviously, you'll need > > lynx installed for this to work :-) > > > > Cheers > > Jon > > > > -- > 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: [PHP] Using php as a scripting language within cron jobs?
> Set your cron job up as "lynx -dump http://www.myserver.com/myscript.php > > /dev/null" (or pipe it to a logfile if you fancy) - obviously, you'll need > lynx installed for this to work :-) but this is only needed only if you compile php into apache or am i wrong? if i have the cgi version installed, i can call the php script directly from the shell. The only thing for me to do then, is to set #!/path.to/php in the first line of the script, right? Regards Michael "Jon Haworth" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 67DF9B67CEFAD4119E4200D0B720FA3F010C40D4@BOOTROS">news:67DF9B67CEFAD4119E4200D0B720FA3F010C40D4@BOOTROS... > Hi Henry, > > > Is this possible? > > yup. > > Set your cron job up as "lynx -dump http://www.myserver.com/myscript.php > > /dev/null" (or pipe it to a logfile if you fancy) - obviously, you'll need > lynx installed for this to work :-) > > Cheers > Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using php as a scripting language within cron jobs?
yip it's possible in exactly the same way as you would Perl, use: #/path/to/php /* php code */ and add it to cron as you would a perl script > -Original Message- > From: Henry Grech-Cini [mailto:[EMAIL PROTECTED]] > Sent: 17 May 2002 11:12 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Using php as a scripting language within cron jobs? > > > Hi All, > > Is this possible? > > I really don't want to go back to perl5 to setup an > autoresponder system! > > Henry > > > > -- > 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: [PHP] Using php as a scripting language within cron jobs?
Hi Henry, > Is this possible? yup. Set your cron job up as "lynx -dump http://www.myserver.com/myscript.php > /dev/null" (or pipe it to a logfile if you fancy) - obviously, you'll need lynx installed for this to work :-) Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
On Friday 17 May 2002 18:11, Henry Grech-Cini wrote: > Hi All, > > Is this possible? Yes, compile php as a stand-alone binary, see manual for details. > I really don't want to go back to perl5 to setup an autoresponder system! -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Friends may come and go, but enemies accumulate. -- Thomas Jones */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php