SeanP Posted September 18, 2013 Share Posted September 18, 2013 I have a custom module, that is licensed using the WHMCS Licensing Addon. All of the functions, including the "Suspend" function, work properly when the buttons are pressed from the admin area. However, when the admin cron job runs, and attempts to auto suspend a product because it is overdue on payment, the auto suspend does not work. Apparently, when it cron job calls the suspend function in the module, it does not report an IP or domain when doing the license check, and the module is failing with a licensing error. The license check requires a valid IP and domain to work properly. How do I resolve this, as the cron job does not send an IP or domain? I've tried this from two different servers (one prod, and one dev) with no luck. Am I missing something? Sean 0 Quote Link to comment Share on other sites More sharing options...
SeanP Posted September 18, 2013 Author Share Posted September 18, 2013 It appears the license check uses the $_SERVER array to determine the IP and domain ($_SERVER['SERVER_ADDR'] for IP and $_SERVER['SERVER_NAME'] for domain). This does not work for CLI applications, or when running the module functions from the command line (as during execution of the cron script). Instead, you can use the following: $host= php_uname('n'); // or $host = gethostname(); if using php 5.3 or later $ip = gethostbyname($host); So, I guess I will need to modify the license check code, to use these php functions, if the $_SERVER array doesn't return anything. Has anyone else run into this issue for licensed server modules? 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.