hmaddy Posted May 18, 2023 Share Posted May 18, 2023 When i try to use API for create a ticket through hooks, then its showing server_name is missing. In Log Report its throwing Blank content in logActivity('HMSERVER_NAME: ' . $_SERVER['SERVER_NAME']); I checked it with phpinfo and its showing correct server name. Is there any update required on configuration.php.???? How to solve this issue.? 0 Quote Link to comment Share on other sites More sharing options...
Rubens Kuhl Posted May 18, 2023 Share Posted May 18, 2023 Perhaps using "localhost" instead of the server fully qualified domain name ? 0 Quote Link to comment Share on other sites More sharing options...
Solution hmaddy Posted May 26, 2023 Author Solution Share Posted May 26, 2023 These api variables are not working on cron. so i changed the hook and solved the issue. 1 Quote Link to comment Share on other sites More sharing options...
brianoz Posted May 27, 2023 Share Posted May 27, 2023 The $_SERVER variables are only set when a page runs from the web server, as they're part of the Apache API. So nothing in the $_SERVER[] will be set when code runs outside the webserver. When you run a script from hooks, it's nice to log that's what's happened, may help someone understand the context of what is happening in the future (and thus save them time). You could use something like: $servername = $_SERVER['SERVER_NAME'] ?? 'cron/backend'; It would be even nicer to be able to say whether it came from a backend api or cron. 0 Quote Link to comment 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.