Jump to content

Wrong Server Name on Hooks


hmaddy
Go to solution Solved by hmaddy,

Recommended Posts

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.?

 

 

 

Screenshot_141.jpg

Screenshot_140.jpg

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated