When I try to include a long file path the PHP include fails to load. A short include path works fine.
For example, the following will fail:
../../contents/2010-St-Louis-Rams-Tickets-Season-Package-Includes-Tickets-For-All-Regular-Season-Home-Games/inc/title.inc
Does anyone have any idea where the problem could be?
Please check if your path (including drive name etc) exceeds 260 characters. Because that's the maximum directory length for Windows. Click here to see the reference.
The reference also states that there is the possibility to create extra-long path names by prepending the path name with "\?\". That should expand the maximum path length to 32767 characters. But I have no idea if this can be used within PHP.
I had the same issue with a symfony 1.x project when writing tests that looked something like this:
The thing here is that those /../../.. take a lot of character space. In my case if those were not used it would work.
In symfony you can get the root of you project by calling sfConfig::get('sf_root_dir'), and thus I could change my code in the following way:
This works (in my case) perfectly.
Although here I use the root dir provided by the symfony framework, in your own project it's just a matter of defining the project's root dir somewhere and keep it accessible.