[PHP] To 'f' or not to 'f'

Under some now ancient version of PHP–probably 6, I had a cron job that read:

php -f {my-php-script}

and it ran every day like it was supposed to. Now, under 8.3, the job did not execute any more. I removed the ‘-f’ from the line in cron, and the job runs. What is the difference between with and without ‘f’ if ‘-f’ is supposed to be superfluous?

On Fri, 2024-10-11 at 08:56 -0400, Steve Matzura wrote:

Under some now ancient version of PHP--probably 6, I had a cron job that read:

php -f {my-php-script}

and it ran every day like it was supposed to. Now, under 8.3, the job did not execute any more. I
removed the '-f' from the line in cron, and the job runs. What is the difference between with and
without 'f' if '-f' is supposed to be superfluous?

The php man page says:
-------
--file file
       -f file Parse and execute file
-------
so it looks like it should work but why the { } block? That may be confusing cron.

John

On 10/11/2024 11:43 AM, John Iliffe wrote:

On Fri, 2024-10-11 at 08:56 -0400, Steve Matzura wrote:

  Under some now ancient version of PHP--probably 6, I had a cron job that read:
    php -f {my-php-script}
    and it ran every day like it was supposed to. Now, under 8.3, the job did not execute any more. I
removed the '-f' from the line in cron, and the job runs. What is the difference between with and
without 'f' if '-f' is supposed to be superfluous?
  

The php man page says:
-------
--file file
        -f file Parse and execute file
-------
so it looks like it should work but why the { } block? That may be confusing cron.

John

the {my-php-script} was just supposed to be a placeholder for the email. The actuaql cron command is:

cd /home/tgvpadmin/domains/theglobalvoice.info/public_html && php -f mail_gallery_updates.php

With "-f" in the command, it runs, a mail message is created and sent out by Postfix--I can see it in the mail log, but the message never gets to the intended recipients. I removed the "-f", and it works. Coincidence? I don't think so. Since it doesn't generate any log, which I would get via email, I can't imagine why it wouldn't work with the "-f" in the command. It's academic at this point, as removing the "-f" caused it to work, so I'm leaving it that way.

Try

cd /that/path && php -f ./somescript.php

Linux is picky about file paths.

Sorry for top-posting, android mail is like that.

On Oct 11, 2024, 22:49, at 22:49, Steve Matzura <sm@noisynotes.com> wrote:

On 10/11/2024 11:43 AM, John Iliffe wrote:

On Fri, 2024-10-11 at 08:56 -0400, Steve Matzura wrote:

  
Under some now ancient version of PHP--probably 6, I had a cron job

that read:

  
php -f {my-php-script}
  
and it ran every day like it was supposed to. Now, under 8.3, the

job did not execute any more. I

removed the '-f' from the line in cron, and the job runs. What is

the difference between with and

without 'f' if '-f' is supposed to be superfluous?
  

The php man page says:
-------
--file file
        -f file Parse and execute file
-------
so it looks like it should work but why the { } block? That may be

confusing cron.

John

the {my-php-script} was just supposed to be a placeholder for the
email.
The actuaql cron command is:

cd /home/tgvpadmin/domains/theglobalvoice.info/public_html && php -f
mail_gallery_updates.php

With "-f" in the command, it runs, a mail message is created and sent
out by Postfix--I can see it in the mail log, but the message never
gets
to the intended recipients. I removed the "-f", and it works.
Coincidence? I don't think so. Since it doesn't generate any log, which

I would get via email, I can't imagine why it wouldn't work with the
"-f" in the command. It's academic at this point, as removing the "-f"
caused it to work, so I'm leaving it that way.

Run the command manually and see what the output is!

On Fri, Oct 11, 2024 at 4:27 PM AnrDaemon <anrdaemon@yandex.ru> wrote:

Try

cd /that/path && php -f ./somescript.php

Linux is picky about file paths.

Sorry for top-posting, android mail is like that.

On Oct 11, 2024, 22:49, at 22:49, Steve Matzura <sm@noisynotes.com> wrote:

On 10/11/2024 11:43 AM, John Iliffe wrote:

On Fri, 2024-10-11 at 08:56 -0400, Steve Matzura wrote:

Under some now ancient version of PHP–probably 6, I had a cron job
that read:

php -f {my-php-script}

and it ran every day like it was supposed to. Now, under 8.3, the
job did not execute any more. I
removed the ‘-f’ from the line in cron, and the job runs. What is
the difference between with and
without ‘f’ if ‘-f’ is supposed to be superfluous?

The php man page says:

–file file
-f file Parse and execute file

so it looks like it should work but why the { } block? That may be
confusing cron.

John

the {my-php-script} was just supposed to be a placeholder for the
email.
The actuaql cron command is:

cd /home/tgvpadmin/domains/theglobalvoice.info/public_html && php -f
mail_gallery_updates.php

With “-f” in the command, it runs, a mail message is created and sent
out by Postfix–I can see it in the mail log, but the message never
gets
to the intended recipients. I removed the “-f”, and it works.
Coincidence? I don’t think so. Since it doesn’t generate any log, which

I would get via email, I can’t imagine why it wouldn’t work with the
“-f” in the command. It’s academic at this point, as removing the “-f”
caused it to work, so I’m leaving it that way.