Net_RouterOS icon indicating copy to clipboard operation
Net_RouterOS copied to clipboard

Error in Codeigniter

Open wawananakkaili opened this issue 5 years ago • 7 comments
trafficstars

Succed at Localhost... but Failed to Connect at real Host... Userman use VPS...

Controller :

`function __construct(){ parent::__construct(); require_once(APPPATH.'libraries/PEAR2/Autoload.php'); }

function pelanggan_edit(){

try { $util = new PEAR2\Net\RouterOS\Util($client = new PEAR2\Net\RouterOS\Client('103.xxx.xxx.xxx', 'user', 'password')); } catch (Exception $e) { // mengalihkan halaman ke halaman data pelanggan redirect(base_url().'admin/pelanggan/data?alert=gagal_konek_userman'); }

}`

wawananakkaili avatar Jan 11 '20 04:01 wawananakkaili

What is the error message?

boenrobot avatar Jan 11 '20 07:01 boenrobot

im so gratefull for your response...

i had no Error message now... really failed to run try { } and its go to catch ... nothing happen in my router log...

wawananakkaili avatar Jan 11 '20 09:01 wawananakkaili

You can output the exception for more details.

It sounds like there is an input rule in the filters that prevents API connectons. By default, MikroTik devices have a rule blocking all incoming connections from the internet. Maybe it's that.

boenrobot avatar Jan 11 '20 09:01 boenrobot

i work it from my PC windows 10 with XAMPP v3.2.4... Userman server @ VPS with Static IP Public... PHP version: 7.3 ... Linux Web Server from rumahweb.com... @mikrotik VPS, have no filter rule...

i think, my problem in this area... require_once(APPPATH.'libraries/PEAR2/Autoload.php');

default structure codeigniter new library class must be load from 'autoload.php' $autoload['libraries'] = array('PEAR2\Autoload');

file : /public_html/application/libraries/PEAR2

but, Error : Unable to load the requested class: PEAR2\Autoload

and once again, its work in localhost but failed at website host.... i was try to change / slash or \ backslash, or uppercase and lowercase... all cant work

wawananakkaili avatar Jan 11 '20 10:01 wawananakkaili

Check APPPATH and what the full path ends up as.

I suspect it might not end with a slash on your VPS, but end with a slash locally.

If you add a slash before "libraries", it should work regardless of whether there's a slash.

boenrobot avatar Jan 11 '20 11:01 boenrobot

File position : Local : C:\xampp\htdocs\khabilasa\application\libraries\PEAR2
Server : /public_html/application/libraries/PEAR2

if i write : require_once(APPPATH.'application/libraries/PEAR2/Autoload.php'); or $util = new application\PEAR2\Net\RouterOS\Util($client = new application\PEAR2\Net\RouterOS\Client('103.xxx.xxx.xxx', 'user', 'password'));

it will be failed even in the localhost

wawananakkaili avatar Jan 11 '20 14:01 wawananakkaili

I meant you should check the APPPATH in the VPS, since that's where the problem is. The full path that ends up in the require_once may be wrong there, but correct on localhost.

The class names begin the same way (with "PEAR2") no matter the files' location.

boenrobot avatar Jan 11 '20 14:01 boenrobot