Michael Ryden
Michael Ryden

Reputation: 33

How to make a php script run a specific command

I have a command line that I run from a specific directory to resize images, but I now need it to run from a php script so I can put it into a cron job to automate. The command is mogrify -resize 800x800\> *.jpg. I'm only looking for help to set up the php script, as I'm novice to doing this. Thanks in advance.

Upvotes: 1

Views: 110

Answers (1)

kojiro
kojiro

Reputation: 77137

Cron has nothing to do with php. Have you tried putting

cd "$whatever_directory" && mogrify -resize 800x800\> *.jpg

in cron?

That said, you can get php to execute shell commands with exec and shell_exec, but I would urge you to consider if that's what you want.

Upvotes: 3

Related Questions