Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache/PHP/MySQL permission question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
patrik1982
n00b
n00b


Joined: 01 Jan 2005
Posts: 19

PostPosted: Mon Jan 17, 2005 6:04 pm    Post subject: Apache/PHP/MySQL permission question Reply with quote

I'm a newbie...

I want to use a phpwiki on my computer. I emerged apache2, mod_php and mysql. Then I inpacked the tar.gz file where I wanted it.

Running php (non DB-access) on the server works. Database access via PHP works in a terminal...

...but I get permission errors when running PHP-script using mysql in my web browser.

I have 2 questions:
1) I know I shouldn't run my computer with my root account. What type of account should I use for everyday-use? How do I create such an account.
2) How do I make sure the apache/php/mysql-thing has the permissions it needs?

EDIT
One more question: When I tried to run apache for the first time I got some error (a non-existing log directory). I created that directory and the server now starts... but no log files are generated. What is wrong?
Back to top
View user's profile Send private message
danorris
Tux's lil' helper
Tux's lil' helper


Joined: 04 Dec 2004
Posts: 108

PostPosted: Mon Jan 17, 2005 6:27 pm    Post subject: Reply with quote

Welcome to Gentoo!

You create users with the "useradd" utility. Run "man useradd" to see the options it takes. A basic command might be "useradd -m myusername". You'll then need to change the password on that account with "passwd myusername".

As for the MySQL errors... you'll need to post the actual error messages / logs here.
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Jan 17, 2005 6:40 pm    Post subject: Reply with quote

danorris wrote:
Welcome to Gentoo!

You create users with the "useradd" utility. Run "man useradd" to see the options it takes. A basic command might be "useradd -m myusername". You'll then need to change the password on that account with "passwd myusername".


or, emerge superadduser and run # superadduser <user name>

much easier. :)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
danorris
Tux's lil' helper
Tux's lil' helper


Joined: 04 Dec 2004
Posts: 108

PostPosted: Mon Jan 17, 2005 7:14 pm    Post subject: Reply with quote

Yes, but Gentoo-specific. I try to stick with generic UNIX solutions when helping Linux newcomers. They'll be a lot less frustrated when they get thrown onto another distro (or another UNIX flavor) and discover everything they've learned so far is now wrong...

Also, to patrik: don't take this the wrong way -- but Google will be your friend, ally and confidant in learning Linux, if you let it. There are lots, and lots, and lots of intro pages out there -- tutorials, howtos, etc. For example, a search for "linux add users" turns up plenty of hits.
Back to top
View user's profile Send private message
patrik1982
n00b
n00b


Joined: 01 Jan 2005
Posts: 19

PostPosted: Mon Jan 17, 2005 10:57 pm    Post subject: Reply with quote

danorris wrote:
As for the MySQL errors... you'll need to post the actual error messages / logs here.

The web server error I get is (when going to http://[my ip]/phpwiki/index.php):

Code:
Warning: dba_open(/tmp/wikipagesdb): failed to open stream: Permission denied in /var/www/localhost/htdocs/phpwiki/lib/dbalib.php on line 58

When I'm logged in as "patrik" (my user name), I get the same output when typing
Code:
php /var/www/localhost/htdocs/phpwiki/index.php


But if I log in as root (su) and run the same command, I get the correct ouput in the terminal.

Somehow, apache seems to need root permission to execute the script (or, to access the database). How do I accomplish this?
Back to top
View user's profile Send private message
nobspangle
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1318
Location: Manchester, UK

PostPosted: Mon Jan 17, 2005 11:02 pm    Post subject: Reply with quote

looks like the script is trying to access a file in /tmp are you sure this is where the file should be? If it is you need to make it owned by the apache user as that is the user running the scripts. Try this (as root)
Code:
chown apache:apache /tmp/wikipagesdb
Back to top
View user's profile Send private message
patrik1982
n00b
n00b


Joined: 01 Jan 2005
Posts: 19

PostPosted: Mon Jan 17, 2005 11:13 pm    Post subject: Reply with quote

nobspangle wrote:
looks like the script is trying to access a file in /tmp are you sure this is where the file should be? If it is you need to make it owned by the apache user as that is the user running the scripts. Try this (as root)
Code:
chown apache:apache /tmp/wikipagesdb

Stupid me. I found the solution. There's a config file ../phpwiki/lib/config.php in which I have to enter the user/pass for the database to use. Now it works.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum