Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3039
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: PHP script to only be accessed by cron |
| Date | 2011-08-31 20:49 +0100 |
| Organization | albasani.net |
| Message-ID | <j3m388$86o$1@news.albasani.net> (permalink) |
| References | <04759979-6bc8-4946-8a96-6e85775bc155@19g2000vbv.googlegroups.com> <j3kqst$flm$1@news.albasani.net> <4e5e7f4e$0$2551$e4fe514c@news2.news.xs4all.nl> |
Luuk wrote: > On 31-08-2011 10:20, The Natural Philosopher wrote: >> jwcarlton wrote: >>> I'm writing a PHP script that I want to ONLY be accessed by a >>> predefined cron. Can you guys suggest a way to prevent non-cron >>> accesses? >>> >> 1/. Write it in a proper language for this purpose, C, not php > > > The purpose of this script is not give, at least not by the OP. > Can you tell here why PHP would not be the 'proper language'? > the main thinking Luuk was that to do what he wanted would invove a lot of calls to libraries that are not a standard part of PHP but are a part of the C library Although I stand corrected because get_ppid() does seem to exist in PHP, and that's half the battle. I cant remember the way to programmatically read a process table as ps does, but I am fairly sure php doesn't have a function to do it. > PHP can be used form the comman line quit well, see: > http://www.php.net/manual/en/features.commandline.interactive.php > for some examples > > There's NO need to learn how to program in C, if one can do this task in PHP > Well firstly if you can code PHP its not a huge step to C, especially if you have some crib code. secondly its a shade more secure if you hide passwords and so on inside nmunged data. But my real reason was access to system libaries that dont as a rule come with PHP. Libproc.a is the standard way I believe to examine the /proc filesystem where all this info exists. In the end its a tradeoff between writing something in PHP to interrogate that, and using some pre-existent source code in C I've had similar issues with certain things where PHP did not handle concurrent accesses to certain graphics libraries well. Very strange bugs happened. Re wrote it in C and no more problems as I used a different graphics library that PHP did not support. I am a great fan of PHP but there are times when I abandon it because - mainly - I need a library it doesn't support. And I have not yet tackled the issues of writing my own extensions to it. And although I know you can, I'd rather use shell or C for cron scripts. PHP can be used, but for me its strengths lie in its easy merging with HTML and mySQL: Althouh even there, I have written database interfaces in C easily enough. C just doesn't do outputting of straight HTML the way a ?> does ! :-) I suppose at the end of the day is no big deal to write a massive printf() statement, but is more tedious than a ?>
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PHP script to only be accessed by cron jwcarlton <jwcarlton@gmail.com> - 2011-08-30 17:23 -0700
Re: PHP script to only be accessed by cron "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-30 19:44 -0500
Re: PHP script to only be accessed by cron jwcarlton <jwcarlton@gmail.com> - 2011-08-30 19:16 -0700
Re: PHP script to only be accessed by cron "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-31 07:15 -0500
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-08-31 17:48 +0100
Re: PHP script to only be accessed by cron "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-31 08:34 +0200
Re: PHP script to only be accessed by cron Goran <goran@nospam.com> - 2011-08-31 08:43 +0200
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-08-31 09:20 +0100
Re: PHP script to only be accessed by cron jwcarlton <jwcarlton@gmail.com> - 2011-08-31 02:14 -0700
Re: PHP script to only be accessed by cron "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-31 07:53 -0500
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-08-31 17:58 +0100
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-08-31 17:45 +0100
Re: PHP script to only be accessed by cron "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-09-01 10:55 +0200
Re: PHP script to only be accessed by cron Luuk <Luuk@invalid.lan> - 2011-08-31 20:37 +0200
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-08-31 20:49 +0100
Re: PHP script to only be accessed by cron Luuk <Luuk@invalid.lan> - 2011-09-01 19:11 +0200
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-09-01 20:25 +0100
Re: PHP script to only be accessed by cron Luuk <Luuk@invalid.lan> - 2011-09-01 21:45 +0200
Re: PHP script to only be accessed by cron The Natural Philosopher <tnp@invalid.invalid> - 2011-09-02 00:30 +0100
Re: PHP script to only be accessed by cron Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-09-01 10:42 +0000
csiph-web