mac
mac

Reputation: 291

Difference between sentences of cronjobs

What is the difference between these two cron commands:

/usr/local/bin/php -f /home/username/public_html/...

/usr/local/bin/php -q /home/username/public_html/...

the first one is "-f" and the second one "-q" Cronjob works fine with both of them. I just don't know what is the difference between them.

Thanks.

Upvotes: 0

Views: 44

Answers (2)

wolfgangwalther
wolfgangwalther

Reputation: 1236

From the PHP manual:

f:

-f --file
Parse and execute the specified file. The -f is optional and may be omitted - providing just the filename to execute is sufficient.

q:

-q --no-header
Quiet-mode. Suppress HTTP header output (CGI only).

Since -f is optional and -q only applies to the CGI-version of PHP (you are running the regular command line interpreter, however), this leaves you with the same command twice:

/usr/local/bin/php /home/username/public_html/...

To explicitly answer your question: In this case, there is no difference between those two commands!

Upvotes: 2

Sinri Edogawa
Sinri Edogawa

Reputation: 331

The two options are of PHP command.

 --no-header
   -q             Quiet-mode. Suppress HTTP header output (CGI only).

and

--file file
   -f file        Parse and execute file

are shown in the help doc of PHP, you can check them with man php in your terminal.

Also the synopsis contains

php [options] [ -f ] file [[--] args...]

where the -f seems not to be necessary.

Upvotes: 0

Related Questions