View previous topic :: View next topic |
Author |
Message |
patrik1982 n00b
Joined: 01 Jan 2005 Posts: 19
|
Posted: Mon Jan 17, 2005 6:04 pm Post subject: Apache/PHP/MySQL permission question |
|
|
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 |
|
|
danorris Tux's lil' helper
Joined: 04 Dec 2004 Posts: 108
|
Posted: Mon Jan 17, 2005 6:27 pm Post subject: |
|
|
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 |
|
|
beandog Bodhisattva
Joined: 04 May 2003 Posts: 2072 Location: /usa/utah
|
Posted: Mon Jan 17, 2005 6:40 pm Post subject: |
|
|
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 |
|
|
danorris Tux's lil' helper
Joined: 04 Dec 2004 Posts: 108
|
Posted: Mon Jan 17, 2005 7:14 pm Post subject: |
|
|
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 |
|
|
patrik1982 n00b
Joined: 01 Jan 2005 Posts: 19
|
Posted: Mon Jan 17, 2005 10:57 pm Post subject: |
|
|
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 |
|
|
nobspangle Veteran
Joined: 23 Mar 2004 Posts: 1318 Location: Manchester, UK
|
Posted: Mon Jan 17, 2005 11:02 pm Post subject: |
|
|
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 |
|
|
patrik1982 n00b
Joined: 01 Jan 2005 Posts: 19
|
Posted: Mon Jan 17, 2005 11:13 pm Post subject: |
|
|
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 |
|
|
|