Koozali.org: home of the SME Server

Turning PHP file uploads on

brad wright

Turning PHP file uploads on
« on: October 18, 2002, 01:58:01 PM »
Can someone explain how to turn on PHP file upload funtion... in the file /etc/e-smith/templates/etc/php.ini/60FileUploads

file_uploads = on

How can I get PHP to accept file uploads?? My (4/5th finished) project is dependant on this ability!!!!

Help!!!

Jon Blakely

Re: Turning PHP file uploads on
« Reply #1 on: October 18, 2002, 04:34:24 PM »
It should already be on.

If you can send an attachment via webmail then there is no problem with php upload and the problem would lie within your script.

Do you get any errors in /var/log/messages

Jon

brad wright

Re: Turning PHP file uploads on
« Reply #2 on: October 22, 2002, 07:45:39 AM »
Thanks for your reply, Jon.

Yes, I am getting error messages in my /var/log/messages file.

Oct 22 12:39:12 e-smith httpd: PHP Warning:  open_basedir restriction in effect. File is in wrong directory in /home/e-smith/files/ibays/project1/html/team/putJob/putJob2.php on line 55
Oct 22 12:39:12 e-smith httpd: PHP Warning:  fopen("/tmp/php3aIkKp", "r") - Operation not permitted in /home/e-smith/files/ibays/project1/html/team/putJob/putJob2.php on line 55
Oct 22 12:39:12 e-smith httpd: PHP Warning:  Supplied argument is not a valid File-Handle resource in /home/e-smith/files/ibays/project1/html/team/putJob/putJob2.php on line 55

My script was working prior to upgrading server from 4.1.2 to 5.5.   Is this a PHP or server issue.

Thanks Jon/Anyone..., im at the end of my tether here :)

Dan Brown

Re: Turning PHP file uploads on
« Reply #3 on: October 22, 2002, 08:13:13 AM »
Ah, then in that case, your problem is quite simple--just do a search here for open_basedir and you should find the solution.  There might be a bug listing as well, I'm not sure.

brad wright

Re: Turning PHP file uploads on
« Reply #4 on: October 22, 2002, 09:30:49 AM »
thank you soooo much... after checking out a security FAQ, got it fixed....

BTW, anyone trying to enable 'file uploads' this FAQ link will show you how.
http://www.e-smith.org/faq.php3#6q12

NB... not mentioned in the FAQ is that it seems you need to reboot your server afterwards to have it take effect.  I didnt think of this (obvious in hindsite i guess :) and took 10 mins of frustration to think of rebooting.  Works a treat after reboot !!

:D

Thanks again

Steen Loecke

Re: Turning PHP file uploads on
« Reply #5 on: January 18, 2003, 12:26:50 PM »
Hi Friends...

First sorry for my english, but I hope you understand what my issue is :)

I have a similar problem as Brad and I followed his advise and do the job as described in the FAQ-link (I also remember to reboot); but my script (upload.php) gives me this line in /var/log/message:
"Jan 18 09:53:18 moornook httpd: PHP Warning:  open_basedir restriction in effect. File is in wrong directory in /home/e-smith/files/ibays/anbay/html/annews/newsadmin/upload.php on line 111"

In line 111 in upload.php I have this:
copy($userfile, $dirname."/".$filename) or die("Error: could not copy file.");

Now comes the tricky part :)

If I edit my php.ini and insert this:
upload_tmp_dir=/home/e-smith/files/ibays/anbay/html

..then my upload-script works fine; but it is not a solution for my SME-server (ver. 5.5 update1) because then file upload only works for that specific ibay, and I have severals virtualdomains. No, I want it should work for all my domians. So here comes my question: How do I do that??? Is there a workaround? I hope :))

Best regards
Steen Loecke

Steen Loecke

Re: Turning PHP file uploads on
« Reply #6 on: January 18, 2003, 04:26:21 PM »
Hi :))

Now it works! I use this commands as root:

/sbin/e-smith/db accounts setprop my_i-bay_name PHPBaseDir /    
/sbin/e-smith/signal-event ibay-modify my_i-bay_name

The reason why it did't work in first place was a slip of the pen :-/

Cheers
Steen Loecke