Chmod(): operation not permitted

Hello,

I am having an odd issue. When adding a phone extension in OSS Endpoint Device List - I receive the following error:

Whoops \ Exception \ ErrorException (E_WARNING)

chmod(): Operation not permitted
/var/www/html/admin/modules/endpointman/includes/functions.inc

                        }
                    } else {
                        if (file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) {
                            if (!file_exists(dirname($write_path . $data))) {
                                [email protected](dirname($write_path . $data), 0775);
                            }
                            copy(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data, $write_path . $data);
                            chmod($write_path . $data, 0775);
                        }
                    }

The extension and phone adds but it is unusable on the system. I have tried to run amportal chown but this does not fix it. I do not want to make many blind permissions changes so I thought I’d inquire with the experts.

This is FreePBX 13.0.120