LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-05-2016, 11:28 PM   #1
qajaq
Member
 
Registered: Sep 2008
Location: north-central Florida
Distribution: Lubuntu 19.04, Kubuntu 18.04
Posts: 120

Rep: Reputation: 15
Apache2 will not load index.php via symlink


I have an index file that was formerly a simple index.html file. I had this file saved as /datalib/Dropbox/foobar/index.html and linked from the foobar subdirectory of my Apache root directory with a symlink:
Code:
index.hmtl -> /datalib/Dropbox/foobar/index.html
All worked well when I pointed my browser to http://localhost/foobar/index.html

Then I added some PHP coding. During the writing and testing process, I had the index.php file in the foobar subdirectory of my Apache root directory, and again all worked well: I was able to open it by pointing my browser to http://localhost/foobar/index.php

However, when I moved the PHP file into the /datalib/Dropbox/foobar subdirectory and set up a symlink in the foobar subdirectory of the Apache root directory, I cannot open it in my Firefox browser. I get the message 403 Forbidden and I'm told I "don't have permission" to access the file on this server.

In short, I can open an index.html file either directly or through a symlink, and I can open the index.php file directly, but not through a symlink (even after rebooting the computer). File permissions are 775 all the way down to the Apache root.

Any ideas where I should look for the problem?
 
Old 02-06-2016, 03:20 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should check the apache error_log for hints.

Regards
 
1 members found this post helpful.
Old 02-06-2016, 12:39 PM   #3
qajaq
Member
 
Registered: Sep 2008
Location: north-central Florida
Distribution: Lubuntu 19.04, Kubuntu 18.04
Posts: 120

Original Poster
Rep: Reputation: 15
Thanks, bathory. I found the error.log file and the relevant message is
Quote:
Symbolic link not allowed or link target not accessible.
I know the link target exists because I can open it with vim using the symlink; and the former symlink to index.html also worked, so I assume that the problem is due to the symlink pointing to a PHP file.

Also - and perhaps due to the same issue - when I simply put http://localhost in my browser's address-bar, I get a hot-link listing of all the other subdirectories of the Apache root - all of which have index.html files - but the foobar subdirectory is not listed.

I don't know where to go from here.
 
Old 02-06-2016, 04:24 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
so I assume that the problem is due to the symlink pointing to a PHP file.
Nah, the file type has nothing to do with this.
Just make sure you're not using "SymLinksifOwnerMatch", or that the target file and the symlink belong to the same user.


Quote:
I get a hot-link listing of all the other subdirectories of the Apache root - all of which have index.html files - but the foobar subdirectory is not listed.
Make sure the (sub)dirs have 755 permissions and the files 644
 
1 members found this post helpful.
Old 02-06-2016, 07:50 PM   #5
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Also if you're using selinux you may need to tell selinux you're using files in a directory outside the default directory for www files.
 
Old 02-06-2016, 09:40 PM   #6
qajaq
Member
 
Registered: Sep 2008
Location: north-central Florida
Distribution: Lubuntu 19.04, Kubuntu 18.04
Posts: 120

Original Poster
Rep: Reputation: 15
bathory -
Quote:
Make sure the (sub)dirs have 755 permissions and the files 644
- Aha! The permissions on the /datalib/Dropbox sub-directory were 705 - I changed them to 775, and all is right in the world! (Well, at least this little corner of it.)

Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 won't load index.php files foucault Linux - Software 11 03-20-2010 09:08 PM
Apache2 executes PHP files if specified, but not index.php will.fletcher Linux - Server 6 07-07-2009 09:27 PM
Apache2 won't load index.php files poojatangi Linux - Software 0 07-09-2008 06:22 PM
Suse 9.3/apache2/php4 - Firefox tries to download index.php, other *php pages work stefanlasiewski SUSE / openSUSE 1 01-18-2006 06:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration