Welcome Guest, Not a member yet? Register   Sign In
Problem with helper function - works ok locally but not on host
#1

[eluser]gypmaster[/eluser]
Hi,

I've got a helper function - MY_security_helper.php which I autoload like this:

Code:
$autoload['helper'] = array('url','form','text','date','security', 'MY_security');

it works just fine on my local wamp install but, when I upload to my web host (hostgator) and try to run my app I get the following CI error:

Quote:An Error Was Encountered

Unable to load the requested file: helpers/my_security_helper.php

I've set the base url as follows:

Code:
$config['base_url'] =  ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ?  "https" : "http");  
$config['base_url'] .=  "://".$_SERVER['HTTP_HOST'];  
$config['base_url'] .=  str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

Anyone know why this error is getting thrown?

TIA
#2

[eluser]WanWizard[/eluser]
Your WAMP runs on Windows, which has a case-insensitive filesystem. Your host most likely uses Unix/Linux, which is case-sensitive.

My guess is that your helper isn't called MY_security, but MY_Security or my_security. Which doesn't work on Unix.
#3

[eluser]gypmaster[/eluser]
Yes, that's right ... my local box is windows and my hosting is linux.

I've changed to
Code:
$config['subclass_prefix'] = 'my_';
in my config file and changed autoloader to load my_security

and called the helper MY_security_helper.php, that throws the same error.

I've left the subclass_prefix as 'my_' and changed the helper file name to my_security_helper.php

that throws the same error.

The change the subclass_prefix to 'MY_' and renamed the helper file to my_security_helper.php

that threw the same error.

So, is there anything else I can do to resolve this?
#4

[eluser]John_Betong[/eluser]
 
http://johns-jokes.com/c_shop/
 
I have just experienced somethng very similar. I just created the above c_cart.php controller that worked fine on my local Windows system but would not load on my Linux host unless I renamed the class to class C_Shop extends MY_controller.
 
I have not changed the $config['subclass_prefix'] = 'MY_';
 
This is weird because the other controllers are all lowercase.
 
 
#5

[eluser]WanWizard[/eluser]
If your subclass_prefix is 'MY_', your file should be called 'MY_security_helper.php'.

You should load it using:
Code:
$this->load->helper('security');
as it is an extension to the CI helper.
#6

[eluser]gypmaster[/eluser]
Still not working on my linux host.

Here's my config:
Code:
$config['subclass_prefix'] = 'MY_';

The helper should be autoloaded - here's my autoload:

Code:
$autoload['helper'] = array('url','form','text','date','security');

function called MY_security_helper.php sits in the application/helpers folder.

When I type www.mydomain.com in address bar, instead of getting my index function I still get the following CI error message:

Quote:An Error Was Encountered

Unable to load the requested file: helpers/my_security_helper.php

anyone know what I'm doing wrong?
#7

[eluser]n0xie[/eluser]
[quote author="gypmaster" date="1252930913"]
function called MY_security_helper.php sits in the application/helpers folder.

Unable to load the requested file: helpers/my_security_helper.php
[/quote]
This is a subtle hint...
#8

[eluser]WanWizard[/eluser]
Without wanting to be patronizing:

what part of "If your subclass_prefix is ‘MY_’, your file should be called ‘MY_security_helper.php’." didn't you understand?
#9

[eluser]gypmaster[/eluser]
yeah, I think I get get the 'subtle hint' - ci is looking for a file called my_security_helper.php ... and I understood all of the stuff in the post above. That's the problem - subclass prefix is set to MY_ & the function is called MY_security_helper.php

but the error message refers to a function called my_security_helper.php and not MY_security_helper.php

so why is theeror message being thrown? wy is it trying to load a function I can't find any reference to?
#10

[eluser]Unknown[/eluser]
It's a bug, reported it #9478.




Theme © iAndrew 2016 - Forum software by © MyBB