Dear All,
I have all the settings correct in my forum and yet I cannot upload attachments can anyone please advise?
I tried to chmod the /forum/attachments directory to 777, 755, 744 and that didn't help fix it. I also tried to change the option in: Admin -> Packages -> Options to All files are writable. and that didn't fix it.
If it may be helpful here's my phpinfo: http://metalje.com/phpinfo.php
I have SMF 1.1.4 and Ancient and Rusted as a theme.
What is phpinfo.php? (http://www.simplemachines.org/community/index.php?topic=18250.0)
Does this happen with all files or just certain files of certain size and extension?
I tried posting pictures with extensions within the allowed list of SMF's administration, and with small sizes (less than 100Kbs) although the size allowed in the forum's administration is 10mbs
Thank you for your reply
Does it stay at 777 when you CHMOD it? Go back and verify the permissions.
I have seen cases where the path is wrong. Use repair_settings.php (http://docs.simplemachines.org/index.php?topic=663) and confirm that all your paths are correct. If incorrect, click on the Recommended values and it should fix it up for you. Save it and then delete this file. See if they work now.
Thank you for your reply.
Yes the directory and all the files are set to 777.
And I used the repair_settings.php file and the paths are correct.
Does my phpinfo.php say anything?
Thanks.
Were you ever able to upload attachments before at all? If so, did you make any changes to the forum before this problem occurred?
The phpinfo.php file looks ok. It shouldn't give you problems especially when you upload smaller files like 100kb (as you said earlier).
I would check to make sure that you do not have any size limits. I just tried uploading a 4kilobyte file, and got the below:
Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.
Please consult your server administrator for more information.
If you get that error, it's not because of a size limitation. Make sure that your attachments is writable and that the path is correct.
Thank you for your replies everyone.
I could never upload an attachment before and the path is correct. This seems strange.
Is your avatars directory writable? See if it's already 755. If not CHMOD it to 755.
Thank you for taking the time to reply greyknight17.
I just tried to chmod -R 777 and 755 attachments/ and that didn't solve the problem although the directory and the files were successfully changed.
How about avatars folder ;)
Can the user that is being ran as the webserver write to your directory?
greyknight17 I changed the permissions for both the avatars dir and the attachments dir to 755, with and without -R
The attachments directory in the Admin -> Attachments & Avatars -> Attachments Settings -> Attachments directory is RED, is this normal? I try to change it to the automatically detected path, which is correct, and also changed it to http://www.metalje.com/forum/attachments and still didn't work.
dan502 can you please elaborate?
Thank you again.
No. Red usually means incorrect path. Can you verify the same thing for Avatars (make sure it's the correct path)? You can use repair_settings.php to check them all just to confirm. Then delete the file when done.
Thank you for replying greyknight17.
The red path in the admin section, is the same path detected by the repair_settings.php file.
path != URL.
It should not be a URL, but a path. ie /home/user/etc...
if it is red, then it can't find the path.
Thank you for replying.
The paths are no longer red, however, I still can't upload anything. Not even a small (allowed) txt file.
have the errors changed at all? Any error log entries? what is the path set as, and, are the permission on it correct?
permission is 777, and the path is correct now.
The error's still the same.
Thanks for replying.
What is the exact error you are getting when you try to upload and what is the corrisponding error you get in your AdminCP error log?
Just a few things:
Attachments mode: Enable all attachments
Allowed attachment extensions: Has the file extensions of the type of files you're uploading
Attachments directory: (text isn't red!) What is here?
Thank you for replying Rumbaar,
Please note that when I try to attach an image I get the following error:
"An Error Has Occurred!
Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.
Please consult your server administrator for more information."
Please note that the file size and extension are allowed and so is attachment mode.
The AdminCP error log shows:
"Apply Filter: Only show the error messages of this member admin Today at 05:19:52 AM
Apply Filter: Only show the error messages of this IP address 92.62.160.3 Apply Filter: Only show the error messages of this session 9a3460d6e230bdb56d9483b451ab3d5c
Apply Filter: Only show the error messages of this URL http://www.metalje.com/forum/index.php?action=post2;start=0;board=13
Apply Filter: Only show the errors with the same message
Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.
Please consult your server administrator for more information."
Attachments directory is: /var/www/virtual/metalje.com/htdocs/forum/attachments/
Please find more the attachment information attached to this msg.
What is the file size of the actual attachment? You might still be running into php.ini restrictions of your server.
Thanks for answering again.
The files I tried to upload were:
1 jpg file with the size of: 130Kb
1 jpg file with the size of: 49Kb
1 txt file with nothing but a line in it.
Going back to the directory path again....
Go to Admin->Attachments and Avatars. Do you see any red text near the attachment directory path there? Try using /htdocs/forum/attachments/ and see if it helps with the attachment problem.
Thank you for your reply greyknight17,
I changed the path to /htdocs/forum/attachments/ which made a red text to be lit near the attachment directory. Got the same error as well.
If you want, send me a PM with temporary access to a admin account and also FTP access (change the password first). I'll take a quick look and see if I can see what the problem is.
Thank you greyknight17, I sent you the private msg
OK, you have more than one error in your log there (877 pages worth....). The one you should have mentioned is probably the below since it gives us more details:
2: is_dir() [<a href='function.is-dir'>function.is-dir</a>]: open_basedir restriction in effect. File(/htdocs/forum/attachments/) is not within the allowed path(s): (/var/www/virtual/metalje.com:/usr/share/php:/tmp/)
File: /var/www/virtual/metalje.com/htdocs/forum/Sources/ManageAttachments.php
Line: 176
You might have to get your host involved in this unless they allow you to change the open_basedir value using a php.ini file. They need to turn that restriction off.
I can change anything there, can you please guide me concerning what to do?
Open up your php.ini file and look for:
open_basedir
See what is it set to now (just curious ;)). Replace it with:
;open_basedir
and see if it helps
in: /etc/php4/apache2/php.ini and in /etc/php5/apache2/php.ini
It already is set to: ;open_basedir =
Thanks again.
Try using open_basedir = none.....
Otherwise, contact your host and ask them how you can disable it. I thought that should have commented it out already...
Not sure if this plays a role, but in your phpinfo file, there is no value set for the Master Value column.
I will do that first thing in the morning.
Thank you for all the help!!
It's strange the path of /htdocs/forum/attachments/ should be /var/www/virtual/metalje.com/htdocs/forum/attachments/ and you've got that set in your attachment settings. So don't know what it's not hitting the correct full path.
Quote from: WolfLust on March 08, 2008, 10:11:11 PM
in: /etc/php4/apache2/php.ini and in /etc/php5/apache2/php.ini
It already is set to: ;open_basedir =
Thanks again.
The problem probably lies in a .htaccess file in the directory. If you view your phpinfo.php file, it shows the master value as none, but the local value as a directory... look at the .htaccess file in your htdocs directory and see if it has a line setting the open_basedir
Thanks for replying SlammedDime,
Here's what's in: /htdocs/forum/attachments/.htaccess
<Files *>
Order Deny,Allow
Deny from all
Allow from localhost
</Files>
Please advise
No no, just look in "/htdocs/" and see if there is an .htaccess file with open_basedir info.
Sorry for the late reply.
I don't have a .htaccess file in /htdocs/
there's only:
/htdocs/htm.htaccess
/htdocs/htmV4.htaccess
/htdocs/html.htaccess
/htdocs/htmlV4.htaccess
/htdocs/phtml.htaccess
/htdocs/phtmlV4.htaccess
/htdocs/htaccess.txt
And in all these the rule is:
;open_basedir =
It may be a bit time consuming, but look in each of the following files and look for anything related to open_basedir
/etc/php5/apache2/conf.d/curl.ini, /etc/php5/apache2/conf.d/gd.ini, /etc/php5/apache2/conf.d/mcrypt.ini, /etc/php5/apache2/conf.d/mhash.ini, /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini, /etc/php5/apache2/conf.d/pspell.ini
Thank you for replying SlammedDime,
I checked all the files and there's nothing about open_basedir about them.
However, in /etc/vhcs2/apache/httpd.conf I found:
<Directory /var/www/vhcs2/gui/tools/filemanager>
php_flag register_globals On
php_admin_value open_basedir "/var/www/vhcs2/gui/tools/filemanager/:/tmp/:/usr/share/php/"
</Directory>
Could this be related?
It also exists in: /root/VHCS/vhcs2-2.4.7.1/configs/apache/httpd.conf
<Directory /var/www/vhcs2/gui/tools/filemanager>
php_flag register_globals On
php_admin_value open_basedir "/var/www/vhcs2/gui/tools/filemanager/:/tmp/:/usr/share/php/"
</Directory>
Those wouldn't be it simply because of the Directory declaration. What type of hosting do you have? VPS? Dedicated? Managed, unmanaged?
SlammedDime it's a shared hosting.
Thank you for replying.
Any fix yet because I am having the same problem
Still facing the same problem, no fix yet.
Here's what I get when I try to reset permissions to all files writable.
Some of the files the package manager needs to modify are not writable. This needs to be changed by logging into FTP and using it to chmod or create the files and folders. Your FTP information may be temporarily cached for proper operation of the package manager.
These guys are pretty good in these forums,we shall have a fix soon.
In that regards, have you tried the Fix Ownership tool in the package manager sticky?
I cannot seem to find that package, can you please link us?
It's the only Sticky in this section ....
Having problems with the package manager? (http://www.simplemachines.org/community/index.php?topic=28393.0)
The tool detected /htdocs/forum/ as my forum path.
In the admin panel it's a different path that's NOT lit in red. Isn't this some kind of a conflict? I still can't upload attachments.
Well your forum path and your attachment paths will be different. Did you run the Fix Ownership tool anyways? If there is some kind of path error, that might explain a few things though.
I did and all it gave me was something like:
This is your forum path please write it down:
/htdocs/forum
Note that this should be fixed in the next update.
Something like that, but I still cannot attach files. Even as admin.
So it wasn't success in CHOWN the files to your account? If it's the issue, not 100% sure, I'd ask you host to CHOWN the files to your account and see if that allows you to set the permissions correctly and access.
How can I know to what owner to chown the files? I have sudo access
Quote from: Rumbaar on March 24, 2008, 05:32:03 PM
It's the only Sticky in this section ....
Having problems with the package manager? (http://www.simplemachines.org/community/index.php?topic=28393.0)
I am not using the package manager and I am not having quite the same problems,I have no red lettering and everything in my admin looks normal unless I am missing a hidden problem somewhere.My data base shows no errors.I have tryed all kinds of different permission changes.I have an email into my host to see if there is a problem they can find because I am also using soholaunch and can not get pictures to upload to my homepage either.
Update,I did nothing except get the hell away from my computor for about 8 hours and now my attachments are working again.please don't ask me how the problem fixed itself.I have however lost most of the site attachments.
Well the main account you have that controls the whole server, I would assume is the one to set CHOWN for all files too. But I've never done this myself, so would know of how wide or encompassing a change is required.
Did you have any luck with this?
I would reccommend going in with SSH, to your forum directory, and run this command
ls -l
.
This will give you a more verbose directory listing, including owner, permissions, etc.
Please paste that here.
Thank you for your reply Metallica48423.
Here's what I get by running ls -l in the attachments dir:
-rw-r--r-- 1 www-data www-data 33854 2008-03-23 20:23 avatar_11.png
-rw-r--r-- 1 www-data www-data 28277 2008-03-15 19:44 avatar_143.png
-rw-r--r-- 1 www-data vu2017 62738 2008-03-26 05:35 avatar_154.png
-rwxr-xr-x 1 vu2017 vu2017 5813 2007-09-29 10:25 avatar_20.gif
-rwxr-xr-x 1 vu2017 vu2017 13370 2007-09-29 10:24 avatar_24.jpg
-rw-r--r-- 1 www-data www-data 61378 2008-03-13 03:44 avatar_32.png
-rwxr-xr-x 1 vu2017 vu2017 3060 2007-09-29 10:25 avatar_34.jpg
-rwxr-xr-x 1 vu2017 vu2017 2847 2007-09-29 10:25 avatar_39.gif
-rwxr-xr-x 1 vu2017 vu2017 4328 2007-09-29 10:24 avatar_41.jpg
-rwxr-xr-x 1 vu2017 vu2017 12962 2007-09-29 10:25 avatar_48.jpg
-rwxr-xr-x 1 vu2017 vu2017 5391 2007-09-29 10:24 avatar_4.png
-rw-r--r-- 1 www-data vu2017 47138 2008-03-25 14:11 avatar_61.png
-rwxr-xr-x 1 vu2017 vu2017 3370 2007-09-29 10:25 avatar_66.jpg
-rwxr-xr-x 1 vu2017 vu2017 44593 2007-09-29 10:24 avatar_68.jpg
-rwxr-xr-x 1 vu2017 vu2017 15622 2007-09-29 10:25 avatar_76.jpg
-rwxr-xr-x 1 vu2017 vu2017 14722 2007-09-29 10:24 avatar_9.jpg
-rwxr-xr-x 1 vu2017 vu2017 74 2008-03-08 20:35 .htaccess
-rwxr-xr-x 1 vu2017 vu2017 327 2007-09-29 10:25 index.php
Can you do that from your base folder of your forum as well, I think we need to see the actual folders.
Certainly, thank you for replying:
ls -l
total 680
-rwsrwsrwx 1 vu2017 vu2017 3355 2007-09-29 10:25 agreement.txt
drwsrwsrwx 2 vu2017 vu2017 4096 2008-03-26 05:35 attachments
drwsrwsrwx 8 vu2017 vu2017 4096 2008-02-13 21:10 avatars
-rwxrwxrwx 1 vu2017 vu2017 439118 2007-09-29 10:25 changelog.txt
drwxrwxrwx 16 vu2017 vu2017 4096 2008-02-17 21:25 chat
-rw-rw-rw- 1 www-data www-data 73 2008-03-19 21:18 dologout.php
-rwxrwxrwx 1 vu2017 vu2017 14803 2008-03-19 21:18 index.php
-rwxrwxrwx 1 vu2017 vu2017 14732 2008-03-19 21:18 index.php~
-rwxrwxrwx 1 vu2017 vu2017 4001 2007-09-29 10:25 license.txt
-rwxrwxrwx 1 vu2017 vu2017 2646 2007-09-29 10:25 news_readme.html
drwsrwsrwx 3 vu2017 vu2017 4096 2008-03-19 21:18 Packages
-rwxrwxrwx 1 vu2017 vu2017 8747 2007-09-29 10:25 readme.html
-rwxrwxrwx 1 vu2017 vu2017 3762 2008-03-25 12:07 Settings_bak.php
-rwsrwsrwx 1 vu2017 vu2017 3762 2008-02-27 18:42 Settings.php
-rwxrwxrwx 1 vu2017 vu2017 3759 2007-09-30 15:45 Settings.php~
drwsrwsrwx 7 vu2017 vu2017 4096 2007-09-29 10:25 Smileys
drwxrwxrwx 2 vu2017 vu2017 4096 2008-03-24 17:52 Sources
-rwxrwxrwx 1 vu2017 vu2017 5692 2007-09-29 10:26 ssi_examples.php
-rwxrwxrwx 1 vu2017 vu2017 5391 2007-09-29 10:25 ssi_examples.shtml
-rwxrwxrwx 1 vu2017 vu2017 60028 2008-03-19 21:18 SSI.php
-rw-rw-rw- 1 www-data www-data 57681 2008-03-19 21:18 SSI.php~
drwsrwsrwx 6 vu2017 vu2017 4096 2007-09-29 10:25 Themes
Hello again everyone,
www-data is the apache user, so I chown the forum directory with a -R to www-data
Still cannot upload attachments.
Thank you for taking the time to read this.
Do you know how to configure virtual hosts in the Apache httpd.conf file? Or do you at least have access to that file? It would normally be located in /etc/php5/apache2/conf/http.conf (based on your file paths). I know you posted two earlier, but those directories didn't seem right... there should be one in the /php5/apache2 directory somewhere as well. You could do a "find /etc/php5 -name 'httpd.conf'" at your shell prompt to find it if its not in the folder I mentioned. If so, could you post that file here (attach it to a post, don't post the whole contents in a post)
Thank you for taking the time to reply SlammedDime,
find /etc/php5 -name 'httpd.conf' returns nothing.
I also tried to updatedb and then locate http.conf and the result is attached to a file in this message.
WolfLust,
Did you get this resolved?
Have you checked the tmp folder is writable in php?
Do a <?php phpinfo(); ?>
Then check to see where the tmp folder is and if it is writable.
When files are uploaded they go to the tmp folder and then are moved by SMF to their new location.
Hello SleePy,
By doing what you asked me I get:
Local Value Master Value
open_basedir /var/www/virtual/metalje.com:/usr/share/php:/tmp/ no value
This means that /tmp is my temp folder right?
by doing ls -al at / I get:
drwxrwxrwx 6 root root 8192 2008-04-10 14:49 tmp
the apache user is: vu2017
Please advise and thank you for your time
WolfLust,
Well thats not the tmp folder, but that does raise another question.
Is your attachment folder in one of those paths set by open_basedir restrictions?
What is the exact error message smf is giving you when you try to upload something?
Hopefully this will point us in the right direction to why it doesn't work.
Are uploads configured in php.ini?
Thanks for replying SleePy,
my attachments folder is: /var/www/virtual/metalje.com/htdocs/forum/attachments/
How can I tell if uploads are configured in php.ini?
And the error msg I get is:
An Error Has Occurred!
Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.
Please consult your server administrator for more information.
SleePy please note that the attachments I'm trying are txt files with a very few lines written inside, and the extension is allowed.
Thank you again.
Hello WolfLust,
I read through the whole topic. What I'm thinking is that, if we assume that the attachments directory is correctly set, then either 1) the routines used for checking that the directory is writable are buggy, or 2) the configuration of your OS somehow prevents attachments from working as expected.
What is the operating system on the server?
If you can send me the login info for an SMF admin account and your own FTP account (change the password first) via PM, I should be able to take a closer look at it.
Hello Sarge,
Thank you for taking the time to read the topic and for replying.
The OS is Linux version 2.6.8-2-386 (
[email protected]) (gcc version 3.3.5 (Debian 1:3.3.5-13)) , and please find the log in and ftp information in a private message sent to you.
Thank you again.
Thank you Sarge!!!!
What a life saver.
Thanks man, attachments finally work.
You're welcome! :)
For the record, the solution was to set the temporary upload directory in php.ini:
upload_tmp_dir = /tmp