XAMPP works fine but I want to have http://localhost/f to point to /home/knarf/prog/php/fwyxz.

  • I've chmod -R 777 /home/knarf/prog/php/fwyxz
  • I've added Alias /f /home/knarf/prog/php/fwyxz at the end of the httpd.conf

And when I try to access it, I get a 403.
From the apache error_log: [error] [client 127.0.0.1] (13)Permission denied: access to /f denied.

I've already tried several solutions (userdir and symlinks) but they both failed with the same error.

I've also tried to add this after the Alias:

<Directory "/home/knarf/prog/php/fwyxz">
    Order allow,deny
    Allow from all
</Directory>

But again, permission denied.

Now if I change the User/Group under which apache runs from nobody to knarf, it seems to work (static files are ok) but PHP can't use/initialize sessions :

[error] [client 127.0.0.1] PHP Warning:  session_start() [function.session-start]: open(/tmp/sess_r5nrmu4ugqguqqe83rs53lq6k0, O_RDWR) failed: Permission denied (13) in /home/knarf/prog/php/fwyxz/index.php on line 3
[error] [client 127.0.0.1] PHP Warning:  Unknown: open(/tmp/sess_r5nrmu4ugqguqqe83rs53lq6k0, O_RDWR) failed: Permission denied (13) in Unknown on line 0
[error] [client 127.0.0.1] PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0

This is really frustrating.

link|improve this question
feedback

migrated from stackoverflow.com Mar 11 '11 at 18:30

This question came from our site for professional and enthusiast programmers.

2 Answers

Apache has to have access permissions for all directories along that tree, that means home, knarf, prog, php, AND fwyxz have to have read/execute for Apache.

Your chmod only does the changes from fwyxz on downwards. However, you may not want to make /home 777 as apache could read everyone's home dirs then.

link|improve this answer
chmod 755 /home is better – azat Mar 11 '11 at 16:56
I've chmod -R g+rx ~knarf and changed Group (in apache) to "users" (which knarf belongs to). Same problem. – knarf Mar 11 '11 at 17:00
Try modifying the alias, remove one level from the target dir each test and see if/when apache starts being able to read it. – Marc B Mar 11 '11 at 17:03
It fails at /home/knarf with [crit] [client 127.0.0.1] (13)Permission denied: /home/knarf/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable. I have no .htaccess there. I've tried to create a 777 empty one but it fails with the same error. – knarf Mar 11 '11 at 17:12
I guess try setting knarf to 777 to see if that fixes it, though it's not a good solution. – Marc B Mar 11 '11 at 17:24
feedback

Try to use symlinks in linux, not apache alias'es
ln -s /home/knarf/prog/php/fwyxz DOCUMENT_ROOT/f
And add to apache config:
Options FollowSymLinks

For session problem try this:
sudo chown knark:knarf /tmp/sess_*

link|improve this answer
Then you have to make sure apache' set to follow symlinks, which it generally isn't – Marc B Mar 11 '11 at 16:51
You right, add apache option – azat Mar 11 '11 at 16:53
As I said, I've already tried using symlinks. I've set the option and the symlink correctly, but it still doesn't work. From the error_log: [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /opt/lampp/htdocs/f – knarf Mar 11 '11 at 17:01
Try to use sudo su apache_user and than cd /opt/lampp/htdocs/f – azat Mar 11 '11 at 17:05
feedback

Your Answer

 
or
required, but never shown