Symbolic link not allowed or link target not accessible
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 :-
- The apache configuration doesn’t allow to Follow Sym Links.
- The SymLink owner doesn’t match (it usually happens on WHM/cPanel server since cPanel assigns a unique user for every domain)
To 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.
Eg :- Domain name : testdomain.com & cPanel user : testuser
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
- Add
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 🙂