Development of WHM Plugin in PHP
I'm developing a WHM Plugin in PHP by following the CPanel documentation guidelines available at Guide to WHM Plugins - Interfaces - Developer Documentation - cPanel Documentation But when I access the plugin I'm getting the following error message:
Warning: file_get_contents(/var/cpanel/caches/_generated_header_files/3679936585_0_0.html): failed to open stream: No such file or directory in /usr/local/cpanel/php/WHM.php on line 71
-
Hello @rgsites, Can you verify which cPanel & WHM version is installed on this system? Also, does the issue persist if you run the /scripts/rebuild_whm_chrome command? Thank you. 0 -
Hello @cPanelMichael I'm using WHM version 76.0.12 Even with the / scripts / rebuild_whm_chrome command, the problem persists. 0 -
Hello @rgsites, Can you let me know the step-by-step instructions I can to reproduce the issue, along with the contents of the PHP plugin? Thank you. 0 -
Hello @cPanelMichael Content is currently empty php require_once ('/ usr / local / cpanel / php / WHM.php'); WHM :: header ('Example Plugin Interface', 0,0); ?> // Add content here. php WHM :: footer (); ?> This is the source code for now I registered the plugin following the guidelines of the page: Guide to WHM Plugins - AppConfig Registration - Developer Documentation - cPanel Documentation But when I access it through the url 0 -
Content is currently empty php require_once ('/ usr / local / cpanel / php / WHM.php'); WHM :: header ('Example Plugin Interface', 0,0); ?> // Add content here. php WHM :: footer (); ?> This is the source code for now
Try using this code instead of leaving the content section empty:
This works on a test system: You may also find the following tutorial helpful as it shows a specific step-by-step real world example: Thank you.0 -
Did not work! In fact, I had tried this, but I decided to retake the test. 0 -
Hi, We are facing the same problem with our WHM plugin (WHM v76.0.14) and /script/rebuild_whm_chrome didn't fix the problem. Do you have some news about the reason why the templates are not generated ? Thank in advance for your information. Philippe 0 -
Hi tizoo, Unfortunately so far I have nothing new to add. As can be seen in the above interactions cPanelMichael recommended I open a support ticket. I have not done it yet, because at the moment the plugin I want to build is not a priority. I recommend you not to waste time open the support ticket. I did numerous searches on the internet and could not find anything to help me. If you can resolve update here, please. 0 -
Hello @tizoo and @rgsites, Can either of you confirm if you are using CloudLinux? Internal case CPANEL-23892 is included with cPanel & WHM version 78 to address an issue where the cache keys for WHM chrome caches are invalid on CloudLinux systems: Fixed case CPANEL-23892: Ensure that cache keys for WHM chrome caches are valid on CloudLinux". The temporary workaround is to modify the below section of /usr/local/cpanel/php/WHM.php with two additional lines of code: if(isset($user)){ //Get user's cache key for JSON file, based on user's name. $cacheKey = self::getUserCacheKey($user); //Load and Process selected header. $skipHeader=1; $skipSupport=1; $headerStr = self::loadFileToStr($cacheDir."/_generated_header_files/".$cacheKey."_".$skipSupport."_".$skipHeader.".html"); $headerStr = self::processHeaderStrings($headerStr, $cpSession, $user, $pageTitle); return $headerStr; }else{ throw new Exception("REMOTE_USER does not exist."); return false; } }
In the above code snippet, the two additional lines added for the workaround are:$skipHeader=1; $skipSupport=1;
Thank you.0 -
Hi cPanelMichael, Thanks for your reply and your time. I confirm that the modification fixed the problem. But our development system is "CentOS release 6.10 (Final)" and not CL. If you need a confirmation on CL, let me know, we have production environments that run CL (6.10 and 7.6). From what you say the bug will be fixed in v78. Do you know when v78 will reach RELEASE state ? Philippe 0 -
Hi @tizoo, But our development system is "CentOS release 6.10 (Final)" and not CL. If you need a confirmation on CL, let me know, we have production environments that run CL (6.10 and 7.6).
As part of the testing for CPANEL-23892, we manually verified the regeneration of chrome caches on both Cloudlinux and CentOS systems succeeded before publishing the case to version 78. If you have a specific server environment you'd like me to test your plugin with, let me know the specific OS and full step-by-step instructions on how to replicate the issue you faced with your plugin prior to adding the workaround. I can replicate the specific environment internally to reproduce the error on version 76, and then update the test server to version 78 to confirm it solves the issue.From what you say the bug will be fixed in v78. Do you know when v78 will reach RELEASE state ?
Version 78 is tentatively planned for publication to the CURRENT tier by the end of January, with the publication to the RELEASE and STABLE tiers expected before Q1 2019 ends. Thank you.0 -
Hello @cPanelMichael, thank you! The proposed solution also corrected my problem. I'm using Centos 6.10 / WHM v76.0.15 0
Please sign in to leave a comment.
Comments
13 comments