private_html to public_html for cronjob

Alen

Verified User
Joined
Oct 2, 2019
Messages
12
hello
i have cron job
php -q /home/user/domain/public_html/folder/file.php

there i have first line:
require_once($_SERVER['DOCUMENT_ROOT']."/wp-load.php");

and i got FATAL ERROR because "DOCUMENT_ROOT" show private_html not public_html also, when i run phpinfo(); i get private_html not public_html

when i open in browser the same file from cronjob it working but on cronjob doesn't

while i'm waiting here i add str_replace('private','public',$_SERVER['document_root']);


also i search about this and found posts here for symlink and have checked on domain setup by default but that not help
 
It's likely creating a HTTPs request when executed, and for HTTPS the docroot has private_html in its docroot path.
 
ok, but what is solution?

also link is https:/domain.com/path/file.php not http
 
https://www.knownhost.com/wiki/control-panels/directadmin/how-to-upload-to-private-html

Sorry, I see that you’ve already tried that. What is your default php and what is the php version your site is set to? Cron’s run with default php unless you’ve enabled set_php_bin_path_in_cron in the DirectAdmin.conf. May be why it executes in the browser but not via Cron?

Test by running the site’s cron.php file with the php versions’ executables installed on your machine as it may be incompatible with the default php version:
Code:
/usr/local/php73/bin/php cron.php
 
Last edited:
Have you checked to make sure the symlink was actually created, too?
Via SSH:
Code:
 ls -lah /home/$user/domains/$domain
 
lrwxrwxrwx. 1 user user 13 Oct 1 14:34 private_html -> ./public_html
 
Back
Top