BetaArchive Logo
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 31d, 6h, 14m | CPU: 37% | MEM: 2801MB of 4645MB used
{The community for beta collectors}

Forum rules


Any off topic discussions should go in this forum. Post count is not increased by posting here.
FTP Access status is required to post in this forum. Find out how to get it


Post new topic Reply to topic  [ 10 posts ] 
Author Message
 PostPost subject: PHP doesn't write on HFS+?        Posted: Sat Oct 04, 2008 6:40 am 
Reply with quote
Donator
User avatar
Offline

Joined
Fri May 18, 2007 9:39 am

Posts
953

Location
My house
I've recently started hosting PHP on an old Mac I had. Installation went smooth and everything seemed fine. Except for one thing. Trying to write files using the fwrite command didn't work. Why is that? Is it because PHP isn't compatible with HFS+ or am I supposed to use a different command or is it something else?

_________________
Image


Top  Profile
 PostPost subject:        Posted: Sat Oct 04, 2008 7:15 am 
Reply with quote
Donator
User avatar
Offline

Joined
Fri Jun 13, 2008 10:22 am

Posts
2366
Post the code you're using? And more info about which version of PHP and your Mac.


Top  Profile
 PostPost subject: Re: PHP doesn't write on HFS+?        Posted: Sat Oct 04, 2008 8:19 am 
Reply with quote
Administrator
User avatar
Offline

Joined
Fri Aug 18, 2006 11:47 am

Posts
12410

Location
Merseyside, United Kingdom

Favourite OS
Microsoft Windows 7 Ultimate x64
mdogg wrote:
I've recently started hosting PHP on an old Mac I had. Installation went smooth and everything seemed fine. Except for one thing. Trying to write files using the fwrite command didn't work. Why is that? Is it because PHP isn't compatible with HFS+ or am I supposed to use a different command or is it something else?


Did you chmod it so it had permissions to write to the dir?

_________________
Image

BetaArchive Discord: https://discord.gg/epK3r6A


Top  Profile  WWW
 PostPost subject:        Posted: Sat Oct 04, 2008 8:21 am 
Reply with quote
Donator
User avatar
Offline

Joined
Fri May 18, 2007 9:39 am

Posts
953

Location
My house
It happens with every script I use:

http://ground.atwebpages.com/phpexample.txt

A simple script like above will output as "Write unsuccessful".

The PHP version I'm using is Entropy's PHP 5.2.4.
The web server software I'm using is Apache 1.3.
The OS X version I'm using is OS X 10.4.

Any other specs I'll be happy to supply.

Edit: Had to use a link. phpBB doesn't like me writing PHP code in the code tags. :?

_________________
Image


Top  Profile
 PostPost subject:        Posted: Sat Oct 04, 2008 9:57 am 
Reply with quote
Donator
User avatar
Offline

Joined
Fri May 18, 2007 9:39 am

Posts
953

Location
My house
Sorry for double post.

Andy wrote:
Did you chmod it so it had permissions to write to the dir?

What permissions would I change it to? I tried changing everything to both 755 and 644 but that did nothing.

_________________
Image


Top  Profile
 PostPost subject:        Posted: Sat Oct 04, 2008 3:30 pm 
Reply with quote
Donator
Offline

Joined
Sat Aug 19, 2006 1:25 am

Posts
590

Location
Israel
mdogg wrote:
Sorry for double post.

Andy wrote:
Did you chmod it so it had permissions to write to the dir?

What permissions would I change it to? I tried changing everything to both 755 and 644 but that did nothing.

PHP runs by default as user "nobody". 755 means you have full access (7) and everyone else (which includes nobody) has read-only access (5). Try changing it to 777 or chowning the folder to nobody.


Top  Profile
 PostPost subject:        Posted: Sun Oct 05, 2008 2:46 am 
Reply with quote
Donator
User avatar
Offline

Joined
Fri May 18, 2007 9:39 am

Posts
953

Location
My house
ppc_digger wrote:
mdogg wrote:
Sorry for double post.

Andy wrote:
Did you chmod it so it had permissions to write to the dir?

What permissions would I change it to? I tried changing everything to both 755 and 644 but that did nothing.

PHP runs by default as user "nobody". 755 means you have full access (7) and everyone else (which includes nobody) has read-only access (5). Try changing it to 777 or chowning the folder to nobody.

Thanks. Chmodding it to 777 fixed it. I wonder if that's why 7 is a lucky number... :wink:

_________________
Image


Top  Profile
 PostPost subject:        Posted: Sun Oct 05, 2008 9:40 am 
Reply with quote
Permanently Banned
Offline

Joined
Mon Dec 11, 2006 3:09 am

Posts
463
mdogg wrote:
ppc_digger wrote:
mdogg wrote:
Sorry for double post.

Andy wrote:
Did you chmod it so it had permissions to write to the dir?

What permissions would I change it to? I tried changing everything to both 755 and 644 but that did nothing.

PHP runs by default as user "nobody". 755 means you have full access (7) and everyone else (which includes nobody) has read-only access (5). Try changing it to 777 or chowning the folder to nobody.

Thanks. Chmodding it to 777 fixed it. I wonder if that's why 7 is a lucky number... :wink:


CHMOD 101!

Table

U G E
4 4 4 Read
2 2 2 Write
1 1 1 Execute

Key: U = User, G = Group, E = Everyone

The user is the user the file belongs to, which is yourself (if you created the file) or whatever group you chown'ed it to. Group is the usergroup the file is under ownership of. You would likely want a 774 or a 644, first being the senerio that you and the user "nobody" is in the same group the file is assigned to (using chgrp) will have full access, with everyone else a read access. You could also use 644 which will allow just read/write (no execute permissions under the user) and read only access for the rest of the group and everyone else. chmod is really simple, use that table above for your basic permissions, just add up what you need down each column and you get your value (doesn't cover sticky bits or anything but that varies among *nix'es and filesystems).


Top  Profile
 PostPost subject:        Posted: Mon Oct 06, 2008 10:03 am 
Reply with quote
Donator
User avatar
Offline

Joined
Fri May 18, 2007 9:39 am

Posts
953

Location
My house
Zimmy wrote:
mdogg wrote:
ppc_digger wrote:
mdogg wrote:
Sorry for double post.

Andy wrote:
Did you chmod it so it had permissions to write to the dir?

What permissions would I change it to? I tried changing everything to both 755 and 644 but that did nothing.

PHP runs by default as user "nobody". 755 means you have full access (7) and everyone else (which includes nobody) has read-only access (5). Try changing it to 777 or chowning the folder to nobody.

Thanks. Chmodding it to 777 fixed it. I wonder if that's why 7 is a lucky number... :wink:


CHMOD 101!

Table

U G E
4 4 4 Read
2 2 2 Write
1 1 1 Execute

Key: U = User, G = Group, E = Everyone

The user is the user the file belongs to, which is yourself (if you created the file) or whatever group you chown'ed it to. Group is the usergroup the file is under ownership of. You would likely want a 774 or a 644, first being the senerio that you and the user "nobody" is in the same group the file is assigned to (using chgrp) will have full access, with everyone else a read access. You could also use 644 which will allow just read/write (no execute permissions under the user) and read only access for the rest of the group and everyone else. chmod is really simple, use that table above for your basic permissions, just add up what you need down each column and you get your value (doesn't cover sticky bits or anything but that varies among *nix'es and filesystems).

Thanks, Zimmy. I'll keep that in mind.

By the way, I have another problem with PHP. It seems that PHP doesn't report error messages. Is there some sort of option I have to turn on?

Edit: Never mind, I got the error messages working. Thanks for all of your help.

_________________
Image


Top  Profile
 PostPost subject:        Posted: Fri Oct 10, 2008 10:57 pm 
Reply with quote
FTP Access
Offline

Joined
Wed Jun 27, 2007 8:13 pm

Posts
130

Location
France
Code:
;   - Show all errors, except for notices and coding standards warnings
;
error_reporting = E_ALL & ~E_NOTICE

; Print out errors (as a part of the output).  For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below).  Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
;
; possible values for display_errors:
;
; Off        - Do not display any errors
; stderr     - Display errors to STDERR (affects only CGI/CLI binaries!)
;
display_errors = "stderr"


From php.ini


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




Who is online

Users browsing this forum: No registered users and 7 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

Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2018

 

Sitemap | XML | RSS