SonnyKo Posted December 5, 2006 Share Posted December 5, 2006 I recently installed Fedora C5 ( 2.6.18-1.2239.fc5 ) with php (v 5.1.6), mysql and Apache. I am having a problem with this code segment: ..... ..... $dirval = "/var/www/html/softlink"; // softlink is a soft link to another directory (hard) if ( !($handle = @opendir ($dirval))) { ...... ...... this code always gets executed ...... owner and file permissions are not a problem. I have double and triple checked it ...... } ... ...In my previous installation - Fedora C5 ( 2.6.17-1.2174_FC5 ) with php (v 5.1.4), mysql and Apache the exact same code passes through without any problems. Just for info - the directory that softlink links to sits on another hard disk that has to be mounted. This is the same in both installations.Is this a PHP bug? Please help. Link to comment https://forums.phpfreaks.com/topic/29474-opendir-cannot-follow-soft-link/ Share on other sites More sharing options...
keeB Posted December 5, 2006 Share Posted December 5, 2006 it's an apache setting. check your httpd.conf for FollowSymlinks (or something like that) Link to comment https://forums.phpfreaks.com/topic/29474-opendir-cannot-follow-soft-link/#findComment-135315 Share on other sites More sharing options...
SonnyKo Posted December 5, 2006 Author Share Posted December 5, 2006 the options directive in my apache httpd.conf file is this:.Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews.its the same in both installations. :( Link to comment https://forums.phpfreaks.com/topic/29474-opendir-cannot-follow-soft-link/#findComment-135334 Share on other sites More sharing options...
Who Posted December 5, 2006 Share Posted December 5, 2006 Try using php's [url=http://us3.php.net/manual/en/function.is-link.php]is_link()[/url] and [url=http://us3.php.net/manual/en/function.readlink.php]readlink()[/url] functions:[code]$dirval = "/var/www/html/softlink";if (is_link($dirval)){ $dirval = readlink($dirval);}if ( !($handle = @opendir ($dirval))) {}[/code] Link to comment https://forums.phpfreaks.com/topic/29474-opendir-cannot-follow-soft-link/#findComment-135358 Share on other sites More sharing options...
SonnyKo Posted December 6, 2006 Author Share Posted December 6, 2006 It didn't work. :(What did work was that I created a directory onto the same physical hard disk as the Apache files and moved the data to it. The link now points to this directory - no problems. The link was previously pointed to data kept on a USB drive. That still works in the previous installation.I dont understand the difference. Link to comment https://forums.phpfreaks.com/topic/29474-opendir-cannot-follow-soft-link/#findComment-136019 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.