RE: Execute script and redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, April 20, 2006 3:42 am, Peter Lauri wrote:
> That was a smart solution. However, my client have not given me access
> to
> the MySQL database at this stage (just doing a small side project of
> the
> clients web site). If you could not take advantage of database and
> cron job,
> what would you do?
>
> PS! I am not sure that my clients host supports cron jobs  DS!

At that point, I go to the client and explain why I need cron jobs and
database access.

We then either go to the host and get it.

Or we find a host that will provide it.

Or, in extreme cases, I build that side portion of their site on a
good host, and provide some kind of API (however crude it may be) so
that the functionality "appears" on their website, even when it's not
really on their host.

Attempting to fork from exec is an exercise in frustration and
version-specific "gotchas" as well as more than a few generalized
"gotchas"

I've done it, and it is "possible" but it's such a Last Resort, that I
wouldn't recommend it.

In principle, it's as easy as:
<?php
  $command = "send junk off to Web Services shell script $args";
  exec("$command &", $output, $error);
  //This next line is a shameless plug for http://l-i-e.com/perror
  if (function_exists('strerror')) $error .= " " . strerror($error);
  if ($error) error_log("OS Error: $error - $command");
?>

In practice, depending on the setup of the server and a whole host of
conditions I never quite understood, the & will or won't work.

You can maybe fix that with a shell script of your own that does the &
but if you don't have shell access, that's pretty much not fun with
FTP and test/re-test.

Then...  I could go on a lot longer, but am going to quit now.

You could do without the database by just appending the info into a
flat file...

You can find work-arounds to the cron problem in many ways -- Sites
that surf to your page in a cron-like fashion, running cron elsewhere
to hit your own page, etc...

I'd go with any of those before trying to fork in a web environment,
personally.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux