Page 1 of 1
wamp include / require errors
Posted: Sat Dec 29, 2007 10:45 am
by ewel
My problem may not be a Joomla issue per se, and I am not sure where to post this quesiton, but hopefully I can find some asnwers here.
I had a website in development which got hacked and following suggestions in these forums I continued developing on a local server on my pc using WAMP5. First thing I did was to install the template I had been using. In this template a few php files are required or included. This used to work on my online server, but on the local server I get errors. The error using Joomla 1.0 is "Warning: include(C:/wamp/www//includes/....php) [function.include]: failed to open stream: No such file or directory in C:\wamp\...".
First I thought it was a matter of register globals and magic quotes but I get errors regardless of those settings. I also tried with Joomla 1.5 for which I changed the template code a bit but that produces similar errors.
Any idea why this could be?
Re: wamp include / require errors
Posted: Sat Dec 29, 2007 7:34 pm
by bascherz
The syntax used in the include statement doesn't follow URI standards, nor does it follow MS Windows standards (wrong type of slashes). Assuming everything is on your C: drive, try removing the C: and see what happens.
Re: wamp include / require errors
Posted: Sat Dec 29, 2007 10:48 pm
by ewel
Thanks, stupidly enough I did not notice those double slashes before 'includes'! I checked the template's index.php and that include was made by "include ($_SERVER['DOCUMENT_ROOT'] . '/includes/" etc. I noticed that earlier on in the same file another file is required by "require($mosConfig_absolute_path."/templates/" etc. So I copied '$mosConfig_absolute_path' to the include statement and voilá the include error is gone there.
So the Joomla v1.0 site on my local Wamp5 server works without error messages (unfortunately I can now see that the template is not loading properly), but I still have problems with the v1.5 site. Basically I think all my problems are related to the way Wamp handles urls and this is of course somewhat disconcerting for a local test and development server. The '$_SERVER['DOCUMENT_ROOT']' worked on my online site before I had to delete it, and so did the template and everything else.
So, where I put $mosConfig_absolute_path in the v1.0 template, I tried $this->baseurl in the v1.5 template (the templates are identical except I adapted the latter to v1.5). I thought that would work, as it did for the v1.0 site, but I get that error message again. This time no double slashes though.
When I run Joomla Tools Suite on the v1.5 site I get this message "Your WebServer appears not to run under an SuExec environment. Which means your user account and the WebServer process account are different. This can lead to file ownership problems for files made by, or uploaded via, Joomla!". I am guessing that file ownership does not impinge on include and require. Anyway there is little I can do since I cannot chmod files in Windows.
Re: wamp include / require errors
Posted: Sun Dec 30, 2007 3:35 pm
by bascherz
I gave up on trying to use Windows as a development or site testing environment earlier this year for the same sorts of reasons. Another one you need to be aware of is file name case sensitivity. Unix systems care about it, Windows does not. I've seen other things that don't work properly in Windows as well. For instance, the CDATA XML syntax used to HTML tags in the element within a module doesn't render graphics and some other HTML elements properly (in the site back end).
The difference in ownership of files is not an absolute. That depends on how the hosting company (or you) sets up the web server. In many (perhaps most) cases, the username under which the web server itself runs ends up being the owner of any file created by PHP scripts. That's because it is the web server that is running the PHP interpreter. Whereas, when you upload files into your file space, they no doubt are owned by the username associated with your account. To deal with this, you'll need a file manager written in PHP to be able to work on files created by PHP scripts. For Joomla 1.0 the extension of choice is JoomlaXplorer, and for Joomla 1.5 it appears eXtplorer is currently the most-favored extension of this type.
If there's any way you can switch to a Linux system for your site development, I would recommend doing it. You'll probably have fewer problems. Then again, I've also found that you need to quickly become somewhat an expert with Linux just to get started.
Good luck!
Re: wamp include / require errors
Posted: Sun Dec 30, 2007 4:59 pm
by ewel
Thanks for that Bruce, you strengthened me in deciding to abandon the idea of using a local development server. I find managing and modifying Joomla to a satisfactory level already quite challenging and the last thing I need is another steep learning curve on top of that.
I remember some years ago I had trouble with some javascripts for similar reasons but solved that by making a switch for the slash direction dependent on the host. Here it seems the problem runs a bit deeper, and hopefully some day someone will provide a solution really reflecting online hosting.
I told myself the next pc will be Mac OSX or another Linux system, but as long as XP remains stable for me there is no point changing.
So now I am installing Joomla online again and studying the wealth of security information to first secure the site before I do anything else - and avoid repetition. I am installing v1.5 this time. I expect it will give me some extra trouble in the beginning but once RC4 seems stable I thought it makes sense to avoid the future hassle of upgrading.