Server Connect Schedule - will it come to PHP?

Server Connect Schedule - NodeJS only

Will this ever come to PHP or is it only ever going to be Node?

Well in PHP we don’t have control cron - so you will have to add the php files manually to cron.

So we can’t just plugin a schedule like in NodeJS

We can maybe make a central php action that we will need to add to cron but still it is less flexible.

2 Likes

I really need this in PHP… but I have no idea how I would code and integrate it.

Can anyone point me in the right direction about the code for the cron and how to get it to execute a server side action?

Once you know where to set up cron jobs on your server, you could enter something like this:
curl --silent https://mywebsite.com/dmxConnect/api/somefolder/api.php
Obviously you would need to enter the schedule details too.

1 Like

@patrick will check if this can be done easily in PHP.

So that you need to add just one PHP file to cron and we can run all the sub schedules from there.

1 Like

Hey Antony,

If timing is urgent, here’s the basics of doing this on your own:

  1. Create an API action that performs the work. Keep in mind that when executed, it will have its own session, so you won’t have any concept of the current user–you have to rely on the database.

  2. Establish where you are setting up the cron job (search google for your particular environment.) All cron jobs are the same, they consist of a command to run, and a frequency. You just need to decide where you will be setting up the jobs.

  3. Use a curl command to call your API action. Curl is a command line executable that can perform GET, POST, etc. upon a URL (which in this case will be your API).

Here is a sample command for one of my environments:

curl https://my_domain.com/dmxConnect/api/process_tasks.php >/dev/null 2>&1

The suffix of >/dev/null 2>&1 discards the output generated.

This command is just triggering a file to run, using a GET, but you can obviously get more complicated from here.

You could also go the route of calling php and then the name of the file, but I find curl to be easier since you never worry about php versions, etc.

2 Likes

Thanks soooo much for your feedback folks! :slight_smile: