Asked  7 Months ago    Answers:  5   Viewed   39 times

I'm trying to run a php-script on a scheduled basis. So I'd thought crontab was a good idea. The server I'm using is on Linux which I'm not that familiar with. So the problem I'm having is, I don't know how make the script executable from php. I need to reference the script, or put it into a folder that can run php from the command line. So I don't know what path to give my crontab, for example:

5  * * * * var/www/some/path/script.php

I found some vague information about this php executable being found in


But I can't find any php file in there, maybe I don't have it installed? My php5 and apache installation is in:


So my question becomes, is there anyway to execute a php-script with crontab in any other folder, or do I just lack the php executable in usr/bin/php?



Start by typing at a command line:

whereis php

Do this as the user that the cron job will be run under. This will show you the path to your executable. You can then use that path (if it's not already in your PATH variable) in your cron entry:

5 * * * * /your/path/to/php /var/www/some/path/script.php

Edit: you may need to install the php5-cli (Ubuntu package name) package if all you have is the Apache PHP module installed. This will give you the binary executable that you can run from a command line.

Wednesday, March 31, 2021
answered 7 Months ago

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario:

Related usability ticket:

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
answered 7 Months ago

From the man page:

Commands are executed by cron(8) when the minute, hour, and month of year fields match the current time, and when at least one of the two day fields (day of month, or day of week) matches the current time (see ``Note'' below).

and later:

Note: The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (ie, are not *), the command will be run when either field matches the current time. For example, ``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.

In other words, your script runs on the 1st through the 7th as well as any Sunday.

Wednesday, March 31, 2021
answered 7 Months ago

There should not be a space between "*" and "/10". It should be:

*/10 * * * * /usr/bin/php  /home/user/public_html/
Thursday, July 29, 2021
answered 3 Months ago

You cannot call JavaScript from within PHP itself. PHP is not a JavaScript engine.

However, there is a PECL Extension for interfacing with V8:


And you can interface with a (serverside) JavaScript engine. Have a look at node.js and

  • Recommendation for integrating nodejs with php application
Wednesday, August 4, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :