Topic: PHP doesn't seem to be able to write.

Hello.

When trying to upload an avatar to my punBB forum, I consistently get this error message: "PHP was unable to save the uploaded file to a temporary location."

This would suggest that php doesn't have write permissions to the img/avatars folder. According to all that I have found on the internet, it should do with merely unchecking read protection in the Properties dialogue for the corresponding folder. It doesn't work. I have even tried sharing my entire htdocs folder on the network completely open for everyone, but it still refuses to accept any uploads of avatars. I am running punBB 1.2.13 on Windows Server 2003 with PHP 4.4.4, Apache 2.2.3 and MySQL 4.0.18-NT.

2

Re: PHP doesn't seem to be able to write.

This probably because you forgot to give the folder 'avatar' the permition '0777' by chmod.

فهد

3 (edited by goethe 2006-10-07 18:04)

Re: PHP doesn't seem to be able to write.

How do I do that in Windows?

Edit: I have given full permission to everyone in Properties. But it still doesn't work.

4

Re: PHP doesn't seem to be able to write.

windows doesnt need to have any permissions set, Only Linux

Re: PHP doesn't seem to be able to write.

Then there obviously has to be some other problem.. The error message says that "PHP was unable to save [...] to a temporary location". Do you think the 'temporary' part is of any significance?

Re: PHP doesn't seem to be able to write.

using safemode?

Re: PHP doesn't seem to be able to write.

Frank H wrote:

using safemode?

As long as you're referring to Windows safe mode, then no, I'm not.

Re: PHP doesn't seem to be able to write.

no, the php setting

http://se2.php.net/manual/en/features.safe-mode.php

Re: PHP doesn't seem to be able to write.

Ah. But still no, I'm afraid. I checked the php.ini and it is set to "off". This is very odd..

Re: PHP doesn't seem to be able to write.

WS2003 should expain the problem tongue Make sure Apache is allowed to write to the folder (sharing permissions or something, only worked a little bit with it)

11 (edited by MrMister 2006-10-08 21:20)

Re: PHP doesn't seem to be able to write.

It has nothing to do with sharing permissions since when you upload a avatar (I assume that's what you are doing) you are sending a file to a temporary directory and then to the avatar dir using the Internet user's file system permissions (not share permissions, it's important not to get them mixed up).

1) Open a command prompt on the server and type "SET"
2) Check the value of the "TEMP" and "TMP" environment variables (usually "C:\WINDOWS\TEMP")
3) Right-click on the directory above and select properties
4) Select the Security tab
5) Add the IUSR_computername user and select the "modify" checkbox for that user

If it still won't work, repeat steps 3 onwards for the avatars directory.

12 (edited by goethe 2006-10-10 18:33)

Re: PHP doesn't seem to be able to write.

It doesn't work. IUSR_computername (of course, I replaced "computername" with my actual computer name) isn't recognised by the system. It might have some stupid Swedish translation but I can't find anything that works by googling. Does anyone know what I should write in with a Swedish copy of Windows Server 2003?

13 (edited by MrMister 2006-10-11 18:49)

Re: PHP doesn't seem to be able to write.

With the previous instruction replace step 5 with this one:

5) Click on the Add button, Advanced button, Locations button and select your computer name, click the Find Now button and look for a local user with computer_name in its name
6) Add the user found above and select the "modify" checkbox for that user

I am assuming that you have IIS installed but not running. If that is not the case, you have to check that the user under which you run the Apache service is the one that has the permissions to access the temporary directory.

14

Re: PHP doesn't seem to be able to write.

MrMister wrote:

With the previous instruction replace step 5 with this one:

5) Click on the Add button, Advanced button, Locations button and select your computer name, click the Find Now button and look for a local user with computer_name in its name
6) Add the user found above and select the "modify" checkbox for that user

I am assuming that you have IIS installed but not running. If that is not the case, you have to check that the user under which you run the Apache service is the one that has the permissions to access the temporary directory.

IIS is not installed. So I went into C:\Windows\Temp and checked the permissions of that folder, and it appears that although the Administrators group has unrestricted access to that folder, and the user under which I run the Apache server belongs to that group, that particular account was not affected. So I added my account to the list and yes, some boxes were unchecked. The problem is now solved. Thanks a lot, to you and to all!

15

Re: PHP doesn't seem to be able to write.

I have the same problem. But this time its not a windows server, i think its a UNIX server
how can i solve this problem? i have checked the code, and cant find where this temporary folder is

Re: PHP doesn't seem to be able to write.

Take a look at /tmp

17

Re: PHP doesn't seem to be able to write.

the tmp folder doesnt exist anywhere sad
is there a tmp folder in punbb folder?

Re: PHP doesn't seem to be able to write.

No: talk to your host wink

19 (edited by GrepGrok 2007-05-04 12:24)

Re: PHP doesn't seem to be able to write.

Sorry to revive this thread, but I have the same problem as them.  I've checked my img/ folder and my cache/ folder just in case, checked my /tmp folder also correct.  Google got me absolutely nadda (except for this thread) my php sucks so I haven't been able to figure anything out from the source.  So here I am smile now can anyone tell me where the file goes from when the upload button is clicked till the file is in the img/avatar directory, or preferably how to figure that out?  Any help would be greatly appreciated smile.

GrepGrok

EDIT: I almost forgot, I'm running
OBSD 4.0
PHP 5.1
MySQL 5.0
PunBB 1.2.15
Apache 1.3.29

Re: PHP doesn't seem to be able to write.

When it's uploaded, it's stored in the temporary location for PHP (usually /tmp on a Linux system). Then PunBB moves it to the avatars folder.
If you're getting the original error though, the issue is with the temporary directory

Re: PHP doesn't seem to be able to write.

Yes it's the original error.  Well my /tmp's permissions is set correctly and I haven't been able to think of any other place it would save it to... What sets the temp folder PunBB or PHP?

Re: PHP doesn't seem to be able to write.

PHP does: I'd talk to your host if I were you

23 (edited by GrepGrok 2007-05-04 14:50)

Re: PHP doesn't seem to be able to write.

I'm the host big_smile but I'll read up PHP. Thanks for the help

EDIT: Umm I'm sorry to bother again and this is not really punbb related I'm kinda lost again.  I checked my settings in php.ini and modified the part that said upload_tmp_dir to say "/tmp" now I'm not sure if php's / is the same as apache's / so I created `n tmp in apache's chrooted dir but it still gives me the same error what am I missing? or where can I go read up on what I'm missing?  I found this "http://www.php.net/manual/en/configuration.changes.php" but it didn't help me


P.S Please excuse the errors I'm a little tired at the moment