FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Only Allow exec in CLI
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Only Allow exec in CLI [message #179188 is a reply to message #179180] Mon, 24 September 2012 17:45 Go to previous messageGo to previous message
Michael Vilain is currently offline  Michael Vilain
Messages: 88
Registered: September 2010
Karma:
Member
In article <50604d45$0$6941$e4fe514c(at)news2(dot)news(dot)xs4all(dot)nl>,
Erwin Moller <erwinmollerusenet(at)xs4all(dot)nl> wrote:

> On 9/24/2012 1:43 PM, The Natural Philosopher wrote:
>> M. Strobel wrote:
>>> Am 24.09.2012 01:14, schrieb cph:
>>>> For security I am looking to add exec() and similar commands to the
>>>> disable functions setting in php.ini but I do have a need to execute
>>>> command line commands within a
>>> cron job I am writing in PHP.
>>>
>>> The answer is highly dependent on your system setup, as has been said
>>> already.
>>> I would start with a check to see if different .ini files for web
>>> server and CLI are
>>> in place already.
>>>
>>> /Str.
>>
>> I cant imagine why anyone would put PHP in a cron job to start with.
>>
>> Shell script or C, or both...
>>
>
> Hi TNP,
>
> When I have written a lot of functionality in PHP, and only need to run
> some small part of it, then a cronjob is the fastest way to implement that.
>
> I have a bunch of scripts that run both as webpage or cronjob, depending
> on a single param in the querystring.
> eg:
>
> sendDailyEmails.php?cronjob=Y
>
> If the cronjob=Y is there, the script won't produce any output.
> If it isn't there, It will be very verbose. The output I used to inspect
> and debug.
> The same script can be called from the admin-pages, and as a cronjob.
>
> So, sometimes it is easy to make PHP run as a cronjob.
>
> To stay remotely relevant to this thread, let me add this:
> On my install I had 2 different php.ini's: one for apache for normal
> webrequests, one for the cronjob.
>
> Regards,
> Erwin Moller

Actually, Drupal has a specific script that runs as a cron to check for
updates. And when stuff runs as a cron, the parameter passing uses the
CLI p1 p2 p3 arguments rather than the web-style "?cronjob=Y". There
must be an environment variable you can query in php that will tell you
it's being run as a CLI or CGI script.

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Advice for Literature on PHP-Based Web Development Business Models
Next Topic: Count how many times a value occurs in an array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 22:41:02 GMT 2024

Total time taken to generate the page: 0.05568 seconds