Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Scheduled.php fix when CLI PHP lacks mysqli support
  • Vote Up0Vote Down eddyceddyc
    Posts: 12Sendy user

    As I previously discovered (http://forum.sendy.co/discussion/1168/mysqli-requirement-for-scheduled-script), my provider's PHP installation appears to lack mysqli support in the command line version of PHP, though it works fine in the web version. Some other users have run into similar problems.

    I came up with a simple workaround that fixed it for me; posting here in case it's of use to others. Essentially, it's just a new script, scheduled-cli.php, which invokes the original scheduled.php script via the web using curl. The cron entry is then modified to call scheduled-cli.php instead of scheduled.php.

    Here's my scheduled-cli.php:

    <?php ini_set('display_errors', 1);?>
    <?php
        include('includes/config.php');
        $url = APP_PATH."/scheduled.php";
    $c = curl_init($url);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        $page = curl_exec($c);
        curl_close($c);
    ?>
    

    Ben, are there any gotchas I should watch out for using this approach?

    Thanks,

    Eddy

  • 2 Comments
  • Vote Up0Vote Down BenBen
    Posts: 3,507Sendy support

    Hey Eddy,

    Doesn't look like this would be a problem. But I thought of another alternative which may work (since your host's command line version of PHP does not have mysqli), which is by using a curl command instead of php:

    curl -L -s http://your_sendy_installation_url/scheduled.php > /dev/null 2>&1

    If this works, you don't have to use an additional script like what you've done as a workaround.

    Thanks.

    Ben

  • Vote Up0Vote Down eddyceddyc
    Posts: 12Sendy user

    Hi Ben,

    That's a much neater solution - thanks! (I prefer not having to tweak the default install if at all possible.)

    Just tried it out and it works perfectly.

    Cheers,

    Eddy

This discussion has been closed.
All Discussions