Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Codeigniter #58

Open
wawananakkaili opened this issue Jan 11, 2020 · 7 comments
Open

Error in Codeigniter #58

wawananakkaili opened this issue Jan 11, 2020 · 7 comments

Comments

@wawananakkaili
Copy link

wawananakkaili commented Jan 11, 2020

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');
}

}`

@boenrobot
Copy link
Member

What is the error message?

@wawananakkaili
Copy link
Author

wawananakkaili commented Jan 11, 2020

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...

@boenrobot
Copy link
Member

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.

@wawananakkaili
Copy link
Author

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

@boenrobot
Copy link
Member

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.

@wawananakkaili
Copy link
Author

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

@boenrobot
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants