Unable to access practice settings

Situation
I am unable to access my practice settings. When I attempt to, I get the following error:
Unable to load controller PracticeSettings , please check the first argument supplied in the URL and try again

OpenEMR Version
I’m using OpenEMR version: v5.0.2 (5).

Browser:
I’m using: Google Chrome (MacOS) is up to date Version 88.0.4324.96 (Official Build) (x86_64)

Operating System
I’m using: AWS Ubuntu 16.04.7 LTS (GNU/Linux 4.15.0-1091-aws x86_64).

Logs

[Sun Jan 31 02:23:43.191652 2021] [php7:warn] [pid 21815] [client xx.yy.zz.aaa:56354] PHP Warning:  include_once(/var/www/localhost/htdocs/opener/controllers/C_PracticeSettings.class.php): failed to open stream: No such file or directory in /var/www/localhost/htdocs/openemr/library/classes/Controller.class.php on line 71, referer: https://xxxxxxxx.com/interface/main/tabs/main.php?token_main=cZxAZBRxMRRB3EM3u8ySOAGG2ZbQPMybn7G43kjA
[Sun Jan 31 02:23:43.191717 2021] [php7:warn] [pid 21815] [client xx.yy.zz.aaa:56354] PHP Warning:  include_once(): Failed opening ‘/var/www/localhost/htdocs/openemr/controllers/C_PracticeSettings.class.php’ for inclusion (include_path=‘/var/www/localhost/htdocs/openemr/vendor/pear/archive_tar:/var/www/localhost/htdocs/openemr/vendor/pear/console_getopt:/var/www/localhost/htdocs/openemr/vendor/pear/pear-core-minimal/src:/var/www/localhost/htdocs/openemr/vendor/pear/pear_exception:.:/usr/share/php7’) in /var/www/localhost/htdocs/openemr/library/classes/Controller.class.php on line 71, referer: https://xxxxxxxxx.com/interface/main/tabs/main.php?token_main=cZxAZBRxMRRB3EM3u8ySOAGG2ZbQPMybn7G43kjA

This is a bump to bump this thread. I’m still hoping to get some help with identifying the issue and correcting it. Any ideas?

looks like there’s a typo in the script that tried to include

[Sun Jan 31 02:23:43.191652 2021] [php7:warn] [pid 21815] [client xx.yy.zz.aaa:56354] PHP Warning:  include_once(/var/www/localhost/htdocs/opener/controllers/C_PracticeSettings.class.php)

see how openemr is spelled opener?

it’s prob in

interface/main/tabs/menu/menus/standard.json

I think this is at least one of the relevant sections of

interface/main/tabs/menu/menus/standard.json

and it looks benign:

      {                                                                         
        "label": "Practice",                                                    
        "menu_id": "adm0",                                                      
        "target": "adm",                                                        
        "url": "/controller.php?practice_settings&pharmacy&action=list",        
        "children": [],                                                         
        "requirement": 0,                                                       
        "acl_req": [                                                            
          "admin",                                                              
          "practice"                                                            
        ]                                                                       
      },                                                                        

But somehow the path is not being assembled correctly for some reason. I wonder why.

this seems vaguely familiar, did you have a similar issue a year or two ago?

There was a somewhat similar issue that involved reports Unable to run reports: Not Found: The requested URL /report/patient_report.php was not found on this server … I will take a look at the user settings (patient menu role, etc.) and see if this where the problem is.

It doesn’t look like there is anything non-standard in my menu settings under my user.
(See image)

checkout that custom.json script as before

/var/www/localhost/htdocs/openemr # find ./ -name custom.json
/var/www/localhost/htdocs/openemr # 

I’m unable to find a custom.json file.
–RBL

find . -name Custom.json

Perfect. Found two files:

./sites/default/documents/custom_menus/Custom.json
./sites/default/documents/custom_menus/patient_menus/Custom.json

The first file has the usual benign appearing JSON elements (without the initial part of the path):

      {                  
        "label": "Practice",
        "menu_id": "adm0",  
        "target": "adm",    
        "url": "/controller.php?practice_settings&pharmacy&action=list",
        "children": [],                                                 
        "requirement": 0,                                               
        "acl_req": [                                                    
          "admin",                                                      
          "practice"                                                    
        ]                                                               
      },                                                                

The second file does not contain “Practice”. I wish I knew how the complete path was assembled so that I could understand why the overall path is not correct.

Hi Ralf,
I’ll take a quick look to at least see where the url gets mangled. The smarty controller errors can be a little difficult to track.

Come from web_root which is your root openemr directory however, it appears you have a path set somewhere that is including the the root directory ie opener/controller.php?practice_settings&.....

The first error causes the second so ignore second.

If you have ability to search soure code with your IDE then do a code search for say, ‘opener/’ or similar…

1 Like

Here is the code that generates the error message.

    function act($qarray)                                                                                                                                                      
    {                                                                                                                                                                          
                                                                                                                                                                               
        if (isset($_GET['process'])) {                                                                                                                                         
            unset($_GET['process']);                                                                                                                                           
            unset($qarray['process']);                                                                                                                                         
            $_POST['process'] = "true";                                                                                                                                        
        }                                                                                                                                                                      
                                                                                                                                                                               
            $args = array_reverse(array_keys($qarray));                                                                                                                        
            $c_name = preg_replace("/[^A-Za-z0-9_]/", "", array_pop($args));                                                                                                   
            $parts = explode("_", $c_name);                                                                                                                                    
            $name = "";                                                                                                                                                        
                                                                                                                                                                               
        foreach ($parts as $p) {                                                                                                                                               
            $name .= ucfirst($p);                                                                                                                                              
        }                                                                                                                                                                      
                                                                                                                                                                               
            $c_name = $name;                                                                                                                                                   
            $c_action = preg_replace("/[^A-Za-z0-9_]/", "", array_pop($args));                                                                                                 
            $args = array_reverse($args);                                                                                                                                      
                                                                                                                                                                               
        if (!call_user_func(array("Controller","i_once"), $GLOBALS['fileroot'] ."/controllers/C_" . $c_name . ".class.php")) {                                                 
            echo "Unable to load controller $name\n, please check the first argument supplied in the URL and try again";                                                       
            exit;                                                                                                                                                              
        }                                                                                                                                                                      
                                                                                                                                                                               
            $obj_name = "C_" . $c_name;                                                                                                                                        
            $c_obj = new $obj_name();                                                                                                                                          
                                                                                                                                                                               
        if (empty($c_action)) {                                                                                                                                                
            $c_action = "default";                                                                                                                                             
        }                                                                                                                                                                      
                                                                                                                                                                               
            $c_obj->_current_action = $c_action;                                                                                                                               
            $args_array = array();                                                                                                                                             
                                                                                                                                                                               
- Controller.class.php [Readonly] 96/176 54%