Attach Files Problem

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Attach Files Problem

Post by AndrewB »

Whenever I try to attach a file to an entry I get a script error.

It looks like it creates a folder under attachments folder with the ID of the FAQ. The owner of the folder is "httpd" The folder does not have write access to it.

Where does the owner "httpd" come from?

How do I get it to work for adding attachments?

thanks.
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

I think I have the same issue as this post:

http://www.phpmyfaq.de/forum/viewtopic. ... ttachement

Safe mode is on, it is not my server, i.e. hosted. Is there anything I can do to allow attachments?
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

Another thing. Why does it create a sub folder with the ID of the FAQ? Why not just use the attachments folder which allows file writes?
Thorsten
Posts: 15741
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Andrew,

this is a big problem with PHP running as Apache module. mod_php (this is the name) is running with the same user id and group id as the Apache user. In your Home directory on the server of your hoster, you have your own user id and your own group id. Since Linux/Unix have a very hard right management, a user isn't allowed to write in a directory from another user.

This is the problem here: The Apache user wants to write in your Home directory, which is not allowed. If PHP would running as CGI on your server, the CGI would be running under your own user rights (which is in my opinion secure) and it can write.

chmod 777 is always evil...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

so there is nothing I can do?

I manually deleted the folder under attachments and created it again. Then I could upload an attachment into it. I will have to do this for each FAQ I want an attachment for I guess.
Thorsten
Posts: 15741
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Andrew,
AndrewB wrote:so there is nothing I can do?
sorrowly you can do nothing, this is what your hoster has to do. :(
AndrewB wrote:I manually deleted the folder under attachments and created it again. Then I could upload an attachment into it. I will have to do this for each FAQ I want an attachment for I guess.
yes, this is the only option. Maybe I'll find a better way in phpMyFAQ 2.0...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

Thorsten - do you have an idea on how hard it would be for me to change the code to upload all files into the attachments folder (not sub folders)?

I might look into this also...
Thorsten
Posts: 15741
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Andrew,

this should be hard... :(
There has to change a lot of code.... maybe I'll find a way.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

oh well...

I don't need many attachments so I am just manually creating the folders right now before I try to upload the attachment.
Thorsten
Posts: 15741
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Andrew,

we're working on the problem in version 2.0!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
hj
Posts: 13
Joined: Tue Jan 13, 2004 1:30 am

Post by hj »

This is a bit of a problem, indeed. But isn't it more of a script problem than a host problem?

My host runs PHP as an Apache module, but this is the first script I've encountered where the upload file/attachment does not work. I have numerous others tested or working with file upload, including the major blog/publishing script pMachine.

File attachment is a really fundamental requirement for me. It's got to work or I'll have to use something else :cry: ....and I don't want to use something else because the phpmyfaq interface and logic is very sound.
Thorsten
Posts: 15741
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

file uploading is a hosting problem. Then PHP runs as Apache module it runs with the rights of the Apache. You can use PHP as CGI and PHP will run as the user which owns the files. Your webhoster should configure the PHP configuration correctly....

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
jmao
Posts: 17
Joined: Fri Jan 09, 2004 5:19 am

I'm my own host,...so what do I need to do?

Post by jmao »

Since I host the server that I want to use attachments, what do I need to do? I've tried making the attachments folder owner:group be that of the apache user (www in this case, Mac OS X). When I do this, a folder is created (ie "1") but nothing goes in and I still get an error. The new folder that is created is owner:group www:www and has rights of 644. The attachments folder itself is set to 777 and still no go,...I have other php scripts running on this server that have similar functions that work,...so I'm confused why this doesn't work,...any ideas?

Thanks!
Jeff
Thorsten
Posts: 15741
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Jeff,

is your PHP running als Apache module or as CGI?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
jmao
Posts: 17
Joined: Fri Jan 09, 2004 5:19 am

PHP

Post by jmao »

As a module.
Post Reply