Symbolic link not allowed or link target not accessible
Issue :
When i was migrating cPanel account to another server through command line using a /scripts/pkgaccount. The package was successfully migrated to a new server and the domain was live again on the new server.But the issue is several functionalities of the site was not working and i got following error was appearing in apache error log constantly
symbolic link not allowed or link target not accessible
Possible reasons :
- Your apache configuration doesn’t allow to Follow Sym Links.
- Your SymLink owner doesn’t match (This usually happens on WHM/cPanel since cPanel assigns a unique user for every domain)
Solutions :
- 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://serverhostname:2086 or http://serverip:2086
- Go To
Main >> Service Configuration >> Apache Configuration >> Global Configuration
Check FollowSymLink
FollowSymLinks
You can also Simply change ownership of your symlink files to particular user from command line.
For Example:
Domain name : testdomain.com
cPanel user : testuser
- Go to Document root of your domain
- cd /home/testuser/public_html/
- Change ownership
chown testuser:testuser *
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.
You can also change the same from command line using following steps:
On 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.
That’s it. Hope this will help you 🙂
Good one.
Keep sharing Noufal.
Thanks for the support.
I’m glad to hear that.