Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vtiger Custom Module : "Sorry! Attempt to access restricted file."

Tags:

php

crm

vtiger

I have created a test module name Mytest. While saving values from the module, I am getting a blank page and it saying "Sorry! Attempt to access restricted file. " . Do anyone know, why this happening. Any help on this is really appreciating.

like image 891
phpqa.in Avatar asked Dec 04 '25 09:12

phpqa.in


2 Answers

The most likely cause for the vTiger error “Sorry! Attempt to access restricted file.” is the $root_directory value in the ‘config.inc.php’ is incorrect or misspelled.

In order to correct it follow the steps below:

Go to your vTigerCRM directory
Open “config.inc.php” with your favorite text editor
Go to line 86 and adjust $root_directory value to correct vTiger 
directory. Note, that the directory must end with /. It should look 
something like this – $root_directory = ‘/var/www/vtigercrm/’;

Also there is a problem with cache memory. So do check your cache file for template files. For that go to your vTigerCRM directory. Then Go to Smarty->templates_c.

Here you will get list of cache files. Delete this file and check weather your problem is solved or not.

Don't worry about deletion of this file.

like image 87
Milan Malani Avatar answered Dec 05 '25 22:12

Milan Malani


When trying to include files from your custom module, you will get these messages because Vtiger thinks you are including these files from a location they find rather unsafe.

To avoid this error you could use the standard way a module is used in Vtiger by navigating to it like so: ......./index.php?module=Mytest&action=index. Vtiger will include your module and now there is no need for you to include CRMEntity and other data or utils related files. It should all be available this way but make sure you are using the global statement for $current_user, $current_module etc though.

Another way is to edit the following functions located in utils/CommonUtils.php:

heckFileAccessForInclusion() and checkFileAccess()

Remove or comment out the die() in these functions to fix it.

like image 45
halfpastfour.am Avatar answered Dec 05 '25 22:12

halfpastfour.am



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!