Apache on windows - need to set file permissions to 777

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Apache on windows - need to set file permissions to 777

Postby RogerTE » 06. August 2016 18:45

Hi,
Just installed XAMPP on a Windows 10 PC. I am the only user of the PC and I log-in as an administrator.

That has run with no problem, and all my own-brewed PHP/MySQL stuff runs ok. Only thing I did notice was that Filezilla and Mercury didn't seem to install. I didn't take much notice of this because I already have Filezilla installed.

Now I am trying out Zenbership before I load it to our Club's server, but am having problems with file protection. The Zembership setup keeps telling me that I need to change permissions to 777 for 5 folders. Now I know that this is chmod (Unix) settings, but I can't seem to change permissions on those folders using file properties. All are writeable by myself, but can't seem to remove the read-only attribute.

I can imagine this must be a relatively common problem, but can't seem to find the answer - for once Google doesn't seem to be my friend :(

Any help appreciated.

Thanks
RogerTE
 
Posts: 2
Joined: 04. August 2016 17:16
XAMPP version: 5.6.23
Operating System: Windows 10

Re: Apache on windows - need to set file permissions to 777

Postby gsmith » 08. August 2016 04:43

This is a bug in zenbership!! That no one has reported it to them is telling of how many Windows servers are running it .... none :D

It took a while to figure this out fully. It's not hard seeing what is going wrong but why it was took awhile because it's subtle.

$path = str_replace('/setup', '', dirname(__FILE__));

The str_replace is failing on Windows because dirname(__FILE__) returns the current path with \backslashes.
for example F:\www\zenbership\public_html\setup

str_replace is looking for /setup which will never match so the directories it needs writable do not even exist since the \setup is not removed from the path .
For example F:\www\zenbership\public_html\setup/admin/sd-system does not exist.

So, on line 29 of setup/index.php and line 41 of setup/process.php change the /setup to \setup.
gsmith
 
Posts: 194
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win XP to 2012R2/VS 6,9,11,14

Re: Apache on windows - need to set file permissions to 777

Postby Nobbie » 08. August 2016 11:17

gsmith wrote:So, on line 29 of setup/index.php and line 41 of setup/process.php change the /setup to \setup.


If you really like to change it, i would not change from slash to backslash (this simply transfers the problem from Windows to Linux, as Linux does not use backslash), instead use the PHP Runtime Constant "DIRECTORY_SEPARATOR" which is set either to slash or backslash, depending on the OS where it is running:

Code: Select all
$path = str_replace(DIRECTORY_SEPARATOR.'setup', '', dirname(__FILE__));


Of course, this *should* already be done by the Zendership development, if they like to have a portable product.
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: Apache on windows - need to set file permissions to 777

Postby gsmith » 08. August 2016 17:03

That is definitely the best fix for the zenbership devs to make upstream.
gsmith
 
Posts: 194
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win XP to 2012R2/VS 6,9,11,14

Re: Apache on windows - need to set file permissions to 777

Postby RogerTE » 09. August 2016 12:18

Many thanks folks - learning more about PHP everyday!
RogerTE
 
Posts: 2
Joined: 04. August 2016 17:16
XAMPP version: 5.6.23
Operating System: Windows 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests