Commands for PHP, curl and wget
Replace USERNAME with the hosting account name and DOMAIN with the actual domain.
PHP command-line script
php /home/USERNAME/domains/DOMAIN/public_html/path/script.phpThis method does not use the web server. Test it over SSH and use php -v to verify the CLI version. PHP selected for a web domain or subdomain does not necessarily select the same CLI version.
On an older CloudLinux server, php may follow the account-wide selector. On a newer server with per-domain and per-subdomain PHP, ask support for the exact binary path if the CLI job requires a specific version.
Call a protected web URL
curl --fail --silent --show-error https://DOMAIN/cron-secret-token >/dev/nullAlternative:
wget -O /dev/null https://DOMAIN/cron-secret-tokenProtect a CRON URL with a secret token or application authentication. Anyone can call an unprotected public URL. Never include the token in screenshots or public documentation.
Paths and permissions
- Use an absolute path beginning with
/home/USERNAME/.... - Web PHP files normally do not need mode 755; 644 is a common safe setting because PHP executes them through the interpreter.
- A standalone shell script needs the correct interpreter, Unix line endings and executable permission.
- Never use 777.