rfresh Posted May 1, 2011 Share Posted May 1, 2011 I need to get the name of the domain my PHP cron script is running on. Normally I use $_SERVER[sERVER_NAME] but that doesn't work when running a cron job under CLI. Is there a command I can use in CLI to get the domain name? Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/235269-php-cli-_server-help-needed/ Share on other sites More sharing options...
trq Posted May 2, 2011 Share Posted May 2, 2011 The cli has nothing to do with any http server, you could likely parse your vhost configuration but I assume you want this to be portable and these configurations are generally different from one setup to another. What exactly do you need the domain for? Quote Link to comment https://forums.phpfreaks.com/topic/235269-php-cli-_server-help-needed/#findComment-1209347 Share on other sites More sharing options...
rfresh Posted May 2, 2011 Author Share Posted May 2, 2011 The script operates on 3 websites so it needs to know which domain it is running on. Quote Link to comment https://forums.phpfreaks.com/topic/235269-php-cli-_server-help-needed/#findComment-1209484 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.