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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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