Jump to content

'../' on linux - mid path?


enition

Recommended Posts

Ok, probably a stupid question but i am using a framework that i don't want to modify any of the core files but at the same time stick to my own directory structure.

 

I have managed to get my scripts running on my windows server but they failed when testing on a linux apache box. I have debugged and it is down to the way i have HAD to include the default controller file.

 

To get around the requirement for the frame work loading a controller from a specific directory i used a dot dot slash mid path:

 

../test/app/controllers/../modules/welcome/controllers/welcome.php

 

on windows this correctly translates to

../test/app/modules/welcome/controllers/welcome.php

but on linux it just fails as it cannot include the file.

 

I know it's not ideal having this but it's the only way to not mess with core files while stinging to a structure i wish to keep to.

 

Is this just how it is or can i achieve this some other way?

 

the ../test/app/controllers/ part of the path is created from the core... hence why i was trying the dot dot slash :)

 

I could have sworn i have seen this work before on linux, so could it be server settings? I am running Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch

 

Any help would be great

 

Thanks,

Adam

Link to comment
https://forums.phpfreaks.com/topic/162130-on-linux-mid-path/
Share on other sites

Yeah, that was the first thought i had but the include happens in the core file so that would still mean modding it to wrap it with realpath()

 

I don't get why it wouldn't work? trying this kind of path in a terminal does end in an error though but i thought that the include function provided by PHP would correct it/realpath it

Link to comment
https://forums.phpfreaks.com/topic/162130-on-linux-mid-path/#findComment-855551
Share on other sites

I am using codeigniter because it's nice a lightweight... I would say it was decent.. no probs, until now! :(

 

But as you can see... i think they made a balls up by hard coding the controller directory

if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT))
{
show_error('Unable to load your default controller.  Please make sure the controller specified in your Routes.php file is valid.');
}

 

Also, after trying realpath it returns false. Seems like linux just doesn't like the dot dot slash mid path :(

 

While im on the subject is there a name for the 'dot dot slash'? Trying to google that is a bit stupid! :)

Link to comment
https://forums.phpfreaks.com/topic/162130-on-linux-mid-path/#findComment-855555
Share on other sites

hmmm... well after looking further into it, it seems that there is some sort of problem with the file exists routine..! :(

 

If i do the include with the path containing the dot dot slash it loads fine!!! :)

 

I am guessing then that this has something to do with my server setup... and highly likely down to the Suhosin patch :(

 

Could someone with Linux+Apache2 WITHOUT Suhosin test this out for me??

Link to comment
https://forums.phpfreaks.com/topic/162130-on-linux-mid-path/#findComment-855585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.