Sujay Kundu
Sujay Kundu

Reputation: 71

How to create a symlink for php project folder in apache's /var/www/html

I want to symlink my php project folder "php-project" in /var/www/html. So whenever i run apache.ie. http://localhost/php-project. The website runs locally. I tried using the following commands

ln -s /Downloads/php-website /var/www/html/php-project

It shows up when i cd to /var/www/html . But whenever i visit the link "localhost/php-website" . It shows

403 Forbidden

Even when i try to give permissions to the /var/www/html/php-project

chmod -777 php-project

It shows

error ": cannot operate on dangling symlink 'php-website'.

Please help me to solve this problem , such that the project folder can be used with the apache server for development process locally.

Upvotes: 1

Views: 2888

Answers (1)

Kevin Sijbers
Kevin Sijbers

Reputation: 824

Normally, Apache does not follow symbolic links, for obvious reasons. This can be changed in the apache config, or for one site specifically by adding this to the .htaccess file:

Options +FollowSymLinks

Also, please make sure you do not use chmod 777 on a system that is accessible from the web (or ever, preferably). For a complete write-up of what to do, see an answer on serverfault: https://serverfault.com/questions/357108/what-permissions-should-my-website-files-folders-have-on-a-linux-webserver

Upvotes: 2

Related Questions