The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Nov 21, 2008 8:42 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 06, 2008 8:34 am
Posts: 7
I have recently installed Joomla 1.5.8 on a Windows Server. (My previous experience using Joomla was on CentOS LAMP.)

Windows 2003 Server Enterprise
Windows NT IIS01001 5.2 build 3790
PHP 5.2.5
MySQL 5.0.45

I have run into a lot of trouble trying to install the Community Builder component (yes, I have posted on the CB forums without much luck) as well as a few other random components I tried to install for testing.

This is the kind of error I was getting:
Code:
 Fatal error: JInstallerComponent::require_once() [function.require]: Failed opening required '\WINFS52\home\users\web\a3485\rh.domain\joomla\administrator\components\com_comprofiler\
install.comprofiler.php' (include_path='.;c:/php5/includes') in \\WINFS52\home\users\web\a3485\rh.domain\joomla\libraries\joomla\installer\adapters\component.php on line 268


Testing with manual php scripts, I determined that the path needs to have FORWARD SLASHES on this server rather than backslashes.

I was not sure how to go about solving this problem, so the first successful method I have tried involves editing two files:

function getPath
libraries\joomla\installer\installer.php line 172

CHANGE TO:
Code:
return (!empty($this->_paths[$name])) ? str_replace('\\','/',($this->_paths[$name])) : $default;


libraries\joomla\installer\adapaters\component.php line 268

CHANGE TO:
Code:
require_once ('/'.$this->parent->getPath('extension_administrator').'/'.$this->get('install.script'));


This reverses all the slashes from backslash to forward slash and also adds a second leading slash to the path.

With these changes, I finally got Community Builder to install successfully, but I'm wondering how many other things might be broken or need edits to reverse slashes to function correctly.


Continuing to look into the problem, I learned about DIRECTORY_SEPARATOR and the DS constant. On this Windows machine, the value given by DIRECTORY_SEPARATOR (which seems to be '\' backslash) doesn't work for any of the Joomla paths. The Joomla component installer only seems to work with FORWARD SLASHES.


So, I'm looking for advice on how to force all the DS constants to FORWARD SLASHES or else somehow disable the OS detection, so Joomla uses only Linux paths and directory separators.

Can I just search for all instances of:
Code:
define( 'DS', DIRECTORY_SEPARATOR );

and replace with:
Code:
define('DS', '/');

?

Is there a better way to this, such as a single file where I can set DS or force it to default to forward slash? Or is there a Windows Server or PHP setting I can change to return a DIRECTORY_SEPARATOR value of forward slash?

Or are there any other better solutions to get Joomla and component installs to run smoothly on this server?

Will these path changes possibly cause any other problems with other parts of the code?

Thank you for your help.


Some more information in my Joomlapolis Forums post


Top
 Profile  
 
PostPosted: Mon Dec 01, 2008 2:51 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 06, 2008 8:34 am
Posts: 7
Does anyone have any input on this issue?

It seems the the host has somehow configured the server to use Linux-style forward searches, but the PHP DIRECTORY_SEPARATOR value is returning a Windows backward slash value, which does not work.

Unless anyone can suggest a better workaround or a server configuration change for my host, I plan to manually edit all the Joomla core files to manually set the DS DIRECTORY_SEPARATOR value and reverse the current value to all forward slashes.

It seems odd that I have to undo the cross-platform aspect of the code to run on a Windows Server.

I would really appreciate any advice on a better solution where I can leave the main Joomla code alone to run on this Windows Server.

Thank you.


Top
 Profile  
 
PostPosted: Wed Feb 18, 2009 1:26 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Tue Oct 04, 2005 3:56 pm
Posts: 437
Well I don't know why first Joomla developers are bothering with this DIRECTORY_SEPARATOR
thing. Windows accept that you use the forward slash for path. Hence you can get "portable" code by systematically replacing backward slash by forward slash in all paths.
If you are retrieving a path somewhere in the code, you can automatically
replace all backward slash by forward before your continue.

i.e :
Quote:
$retrieved_path= strtr( $retrieved_path , '\\', '/');


Top
 Profile  
 
PostPosted: Wed Feb 18, 2009 5:04 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 06, 2008 8:34 am
Posts: 7
mehdi wrote:
If you are retrieving a path somewhere in the code, you can automatically
replace all backward slash by forward before your continue.

Thank you for the reply. Actually, I already arrived at your solution and it seems to have solved my problem. I'm not sure if this is an issue many Windows Server users run into or if there is a problem with my server configuration. I generally try to avoid core edits on a basic install, but I had no choice. Anyway, my initial installation problems are solved now.

function getPath
libraries joomla installer installer.php line 172

CHANGE TO:

Code:
return (!empty($this->_paths[$name])) ? str_replace('\\','/',($this->_paths[$name])) : $default;


libraries joomla installer adapaters component.php line 268

CHANGE TO:

Code:
require_once ('/'.$this->parent->getPath('extension_administrator').'/'.$this->get('install.script'));


This reverses all the slashes from backslash to forward slash and also adds a second leading slash to the path.


Top
 Profile  
 
PostPosted: Mon Apr 20, 2009 7:46 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 07, 2009 8:09 am
Posts: 5
Hello All,

I had the similar problem with installing components on a windows based hosting server.

I get the same error and I tried the solution of changing the DS in '/' also '\' but nothing works.

Kindly advise. Please this is urgent as I need to upload the components (most important is JEvents) which is required for the site to show upcoming events.

regards
Niranjan


Top
 Profile  
 
PostPosted: Tue May 25, 2010 3:30 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue May 25, 2010 3:22 pm
Posts: 1
@ndavis, THANK YOU!!!!!! so much for posting about your problem and solution. I had to follow the same steps to get a component to install on our IIS shared hosting server. I have been searching for a solution for DAYS!!!!

If it matters, the line to modify in component.php above has moved in a more recent version of Joomla (1.5.17) it is now located at 292. No biggie, but thought I would try to help any future visitors.

Thank you again!!!! :D


Top
 Profile  
 
PostPosted: Tue Aug 17, 2010 1:06 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Aug 17, 2010 1:02 pm
Posts: 4
Thanks so much!!! I've been searching forever to figure out how to fix this issue. This is likely happening to anyone hosting a Joomla site on a Windows server where there is no mapped drive and where UNC paths have to be used. THANKS!!!!!!!!!!!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group