You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Akbar <ak...@gmail.com> on 2009/02/07 22:09:18 UTC

[users@httpd] Can't Insert Row Into a SQLite DB on server

Hi. I have a SQLite db file in the same folder with ps.php file. ps.php 
can read from the database file but it cannot write to it.
Is there a way to write to this file. The exact same php code works when 
it's not on the server. Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by André Warnier <aw...@ice-sa.com>.
Akbar wrote:
> André if nothing else, i learned something, thank you. let me see how 
> this goes...
> User www
> Group www
> 
> hmm... Is it correct to say that I cannot make that database file 
> writeable by using a <directory> or <file> directive?
> (i just read your other email)
Yes (you can not).

> 
> Maybe then, i can put the database file in a folder to which the 
> user/group www can write. Thanks.
You could do that also.

> 
> André Warnier wrote:
>> Akbar wrote:
>>> Thank you André, that was pretty gentle. I'll give that information 
>>> in the future.
>>>
>>> It's Apache 1.3 that comes with Mac OS X Tiger.
>>>
>>> I'm not sure how to find out which user started the Apache server. I 
>>> have a guess that it's the admin account on my computer.
>>>
>>>
>> I don't know that environment at all, but you should look at the 
>> apache.conf or httpd.conf file.  Apache usually starts as "root" or 
>> "administrator", but then switches to another user with less permissions.
>> There should be 2 lines
>> User xxxxx
>> Group yyyyy
>> in the configuration file, that indicate which user/group it runs under.
>> In your case, you may want to change the Group to a group that has 
>> write permissions to the SQL folder.  If there are other applications 
>> running under Apache though, be aware that this may cause them to have 
>> problems.
>>
>> But maybe it is safer to wait for someone else's comment, who knows 
>> how things work under Mac OS X Tiger. 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by Akbar <ak...@gmail.com>.
André if nothing else, i learned something, thank you. let me see how 
this goes...
User www
Group www

hmm... Is it correct to say that I cannot make that database file 
writeable by using a <directory> or <file> directive?
(i just read your other email)

Maybe then, i can put the database file in a folder to which the 
user/group www can write. Thanks.

André Warnier wrote:
> Akbar wrote:
>> Thank you André, that was pretty gentle. I'll give that information 
>> in the future.
>>
>> It's Apache 1.3 that comes with Mac OS X Tiger.
>>
>> I'm not sure how to find out which user started the Apache server. I 
>> have a guess that it's the admin account on my computer.
>>
>>
> I don't know that environment at all, but you should look at the 
> apache.conf or httpd.conf file.  Apache usually starts as "root" or 
> "administrator", but then switches to another user with less permissions.
> There should be 2 lines
> User xxxxx
> Group yyyyy
> in the configuration file, that indicate which user/group it runs under.
> In your case, you may want to change the Group to a group that has 
> write permissions to the SQL folder.  If there are other applications 
> running under Apache though, be aware that this may cause them to have 
> problems.
>
> But maybe it is safer to wait for someone else's comment, who knows 
> how things work under Mac OS X Tiger. 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by André Warnier <aw...@ice-sa.com>.
Akbar wrote:
> Thank you André, that was pretty gentle. I'll give that information in 
> the future.
> 
> It's Apache 1.3 that comes with Mac OS X Tiger.
> 
> I'm not sure how to find out which user started the Apache server. I 
> have a guess that it's the admin account on my computer.
> 
> 
I don't know that environment at all, but you should look at the 
apache.conf or httpd.conf file.  Apache usually starts as "root" or 
"administrator", but then switches to another user with less permissions.
There should be 2 lines
User xxxxx
Group yyyyy
in the configuration file, that indicate which user/group it runs under.
In your case, you may want to change the Group to a group that has write 
permissions to the SQL folder.  If there are other applications running 
under Apache though, be aware that this may cause them to have problems.

But maybe it is safer to wait for someone else's comment, who knows how 
things work under Mac OS X Tiger.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by Akbar <ak...@gmail.com>.
Thank you André, that was pretty gentle. I'll give that information in 
the future.

It's Apache 1.3 that comes with Mac OS X Tiger.

I'm not sure how to find out which user started the Apache server. I 
have a guess that it's the admin account on my computer.


André Warnier wrote:
> I was only trying to suggest, gently, that when you post on a list 
> looking for help, you might want to add at least some information 
> about the environment you are using, like which kind of system, which 
> version of Apache, etc..
> People may want to help you, but you cannot expect them to guess this 
> kind of stuff.
>
> Anyway, your problem below sounds very much like a simple permissions 
> problem.  The user under which the Apache server is running probably 
> does not have write permissions to your SQL folder.
> Before you go ahead and give him that though, you may want to think 
> about the security implications.
> There is a reason why usually Apache runs as a user-id that does not 
> have access to everything, and that is because any process started by 
> Apache then has those same permissions.
>
> Akbar wrote:
>> Yes Apache 1.3.
>>
>> André Warnier wrote:
>>> Akbar wrote:
>>>> Hi. I have a SQLite db file in the same folder with ps.php file. 
>>>> ps.php can read from the database file but it cannot write to it.
>>>> Is there a way to write to this file. The exact same php code works 
>>>> when it's not on the server. Thanks.
>>>>
>>> What server ? Apache ?
>>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by Akbar <ak...@gmail.com>.
Thanks for the tip! Sweet dreams! :-)

André Warnier wrote:
> André Warnier wrote:
>> Akbar wrote:
>>> Thank you André, that was pretty gentle. I'll give that information 
>>> in the future.
>>
> One more tip, before I go to bed :
> assuming that Mac OSX is an OS based on Unix/Linux :
> The SQL folder probably has a group-id, and may be writeable by users 
> belonging to that group.
> On the other hand, Unix users can belong to more than one group.
> You could give the user under which Apache runs, an additional group 
> that matches the SQL folder group.  Then restart Apache and try again.
>
> Under Unix/Linux, the way to add a group membership to a user is 
> either one of :
> adduser user-id groupname  (some Linux flavors)
> or more generally :
> usermod -G groupname user-id
>
> like
> usermod -G SQLgroup apacheuser
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by André Warnier <aw...@ice-sa.com>.
André Warnier wrote:
> Akbar wrote:
>> Thank you André, that was pretty gentle. I'll give that information in 
>> the future.
>>
>> It's Apache 1.3 that comes with Mac OS X Tiger.
>>
>> I'm not sure how to find out which user started the Apache server. I 
>> have a guess that it's the admin account on my computer.
>>
>> In the httpd.conf file, there is an example <Directory><> section that 
>> notes that the directory is set up as read only. I haven't seen in any 
>> of the Apache docs how to set up write permissions for a folder say 
>> for a given user (me in this case). Am i barking up the wrong tree there?
> 
> Gently again, I think yes.  I can't think off-hand of anything in the 
> Apache configuration that would give read access but not write access to 
> a directory.  Except, indirectly, the User and Group directives.
> The permissions referred to probably mean the real permissions in the 
> filesystem.
> 
> You need to think of it this way : your php script is run by Apache, 
> with the same user-id and group(s) as the Apache user. It can read or 
> write whatever this Apache user can.
> What you do with the Apache directives within Apache, is controlling who 
> can call (or not) your script.  But once it gets called, that's it.
> 
> 
One more tip, before I go to bed :
assuming that Mac OSX is an OS based on Unix/Linux :
The SQL folder probably has a group-id, and may be writeable by users 
belonging to that group.
On the other hand, Unix users can belong to more than one group.
You could give the user under which Apache runs, an additional group 
that matches the SQL folder group.  Then restart Apache and try again.

Under Unix/Linux, the way to add a group membership to a user is either 
one of :
adduser user-id groupname  (some Linux flavors)
or more generally :
usermod -G groupname user-id

like
usermod -G SQLgroup apacheuser


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by André Warnier <aw...@ice-sa.com>.
Akbar wrote:
> Thank you André, that was pretty gentle. I'll give that information in 
> the future.
> 
> It's Apache 1.3 that comes with Mac OS X Tiger.
> 
> I'm not sure how to find out which user started the Apache server. I 
> have a guess that it's the admin account on my computer.
> 
> In the httpd.conf file, there is an example <Directory><> section that 
> notes that the directory is set up as read only. I haven't seen in any 
> of the Apache docs how to set up write permissions for a folder say for 
> a given user (me in this case). Am i barking up the wrong tree there?

Gently again, I think yes.  I can't think off-hand of anything in the 
Apache configuration that would give read access but not write access to 
a directory.  Except, indirectly, the User and Group directives.
The permissions referred to probably mean the real permissions in the 
filesystem.

You need to think of it this way : your php script is run by Apache, 
with the same user-id and group(s) as the Apache user. It can read or 
write whatever this Apache user can.
What you do with the Apache directives within Apache, is controlling who 
can call (or not) your script.  But once it gets called, that's it.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by Akbar <ak...@gmail.com>.
Thank you André, that was pretty gentle. I'll give that information in 
the future.

It's Apache 1.3 that comes with Mac OS X Tiger.

I'm not sure how to find out which user started the Apache server. I 
have a guess that it's the admin account on my computer.

In the httpd.conf file, there is an example <Directory><> section that 
notes that the directory is set up as read only. I haven't seen in any 
of the Apache docs how to set up write permissions for a folder say for 
a given user (me in this case). Am i barking up the wrong tree there?

Thanks for the response.

André Warnier wrote:
> I was only trying to suggest, gently, that when you post on a list 
> looking for help, you might want to add at least some information 
> about the environment you are using, like which kind of system, which 
> version of Apache, etc..
> People may want to help you, but you cannot expect them to guess this 
> kind of stuff.
>
> Anyway, your problem below sounds very much like a simple permissions 
> problem.  The user under which the Apache server is running probably 
> does not have write permissions to your SQL folder.
> Before you go ahead and give him that though, you may want to think 
> about the security implications.
> There is a reason why usually Apache runs as a user-id that does not 
> have access to everything, and that is because any process started by 
> Apache then has those same permissions.
>
> Akbar wrote:
>> Yes Apache 1.3.
>>
>> André Warnier wrote:
>>> Akbar wrote:
>>>> Hi. I have a SQLite db file in the same folder with ps.php file. 
>>>> ps.php can read from the database file but it cannot write to it.
>>>> Is there a way to write to this file. The exact same php code works 
>>>> when it's not on the server. Thanks.
>>>>
>>> What server ? Apache ?
>>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by André Warnier <aw...@ice-sa.com>.
I was only trying to suggest, gently, that when you post on a list 
looking for help, you might want to add at least some information about 
the environment you are using, like which kind of system, which version 
of Apache, etc..
People may want to help you, but you cannot expect them to guess this 
kind of stuff.

Anyway, your problem below sounds very much like a simple permissions 
problem.  The user under which the Apache server is running probably 
does not have write permissions to your SQL folder.
Before you go ahead and give him that though, you may want to think 
about the security implications.
There is a reason why usually Apache runs as a user-id that does not 
have access to everything, and that is because any process started by 
Apache then has those same permissions.

Akbar wrote:
> Yes Apache 1.3.
> 
> André Warnier wrote:
>> Akbar wrote:
>>> Hi. I have a SQLite db file in the same folder with ps.php file. 
>>> ps.php can read from the database file but it cannot write to it.
>>> Is there a way to write to this file. The exact same php code works 
>>> when it's not on the server. Thanks.
>>>
>> What server ? Apache ?
>>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by Akbar <ak...@gmail.com>.
Yes Apache 1.3.

André Warnier wrote:
> Akbar wrote:
>> Hi. I have a SQLite db file in the same folder with ps.php file. 
>> ps.php can read from the database file but it cannot write to it.
>> Is there a way to write to this file. The exact same php code works 
>> when it's not on the server. Thanks.
>>
> What server ? Apache ?
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't Insert Row Into a SQLite DB on server

Posted by André Warnier <aw...@ice-sa.com>.
Akbar wrote:
> Hi. I have a SQLite db file in the same folder with ps.php file. ps.php 
> can read from the database file but it cannot write to it.
> Is there a way to write to this file. The exact same php code works when 
> it's not on the server. Thanks.
> 
What server ? Apache ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org