Symbolic link not allowed or link target not accessible:
Today I was migrating CPanel account to another server using a WHM/Cpanel Utility /scripts/pkgaccount. Package was successfully migrated to a new server and domain was live again on new server. But several functionality of the site was not working and the following error was appearing in apache error log constantly.
symbolic link not allowed or link target not accessible
There are two possibility of this error:
Your apache configuration doesn’t allow to Follow Sym Links.
Your SymLink owner doesn’t match (This usually happens on WHM/CPanel because CPanel uses unique user for unique domain)
Fix “symbolic link not allowed or link target not accessible” on WHM/CPanel Server :
Connect to your WHM/CPanel with root privileges from browser e.g http://example.com:2086
Go To
Main >> Service Configuration >> Apache Configuration >> Global Configuration
Check FollowSymLink
FollowSymLinks
Now, in our example your domain name is hackersgarage.com and your CPanel user is hacker. Simple change ownership of your symlink files to hacker
Jumple to document root of your domain
cd /home/hacker/public_html/
Change ownership
chown hacker:hacker *
If you are still having difficulties or unable to change ownership of files or its just not working.
You can again Go To;
Main >> Service Configuration >> Apache Configuration >> Global Configuration
Uncheck SymLinksIfOwnerMatch
SymLinksIfOwnerMatch
Save it! It should rebuild Apache configuration and reload httpd daemon.
Fix “symbolic link not allowed or link target not accessible” on With Control Panel Server (CentOS/Ubuntu/RedHat):
vim /etc/httpd/conf/httpd.conf
Add
Options +FollowSymLinks -SymLinksIfOwnerMatch
Reload httpd
/etc/init.d/httpd reload
on debian base distro;
/etc/init.d/apache gracefull
If you don’t have access to httpd.conf, you can add this in your .htaccess of your document root.
vim .htaccess
Options +FollowSymLinks -SymLinksIfOwnerMatch
Save it! Here you don’t need to reload httpd daemon.
Note : Using .htaccess method you need to make sure, your httpd.conf is configured/instructed to read .htaccess in your document root.