We made it to server-side scripting with PHP. The professor said the people with Mac are lucky, got everything installed for them, just need to activate it. Hmm, I got a Mac too….
* Enable PHP :
#uncomment ‘Load php5module … ‘ from /etc/apache2/httpd.conf > All set
Open localhost and see It works, the hello world of Apache.
* The problem with DocumentRoot :
However, the DocumentRoot is set at “/Library/WebServer/Documents/” but my codes are in different location and I don’t want to copy my new codes to the path…..
One solution comes up to my mind is to do symbolic link the codes to documents, which does not work : ln -s /Library/WebServer/Documents /path/to/new/codes ( It shows permission error even though all the files are 755. Some guys said I have to do chmod 755 on parents folder as well as the path; in other words, chmod recursively ).
Why don’t you set DocumentRoot to the new paths instead ? Well, I should but I want to keep the default path. What I want is to point my codes to the new path after localhost,i.e something like localhost/HW6 it will point to HW6 real codes folder. Enter Alias:
Alias /HW6 /HW6 Folder/ #Note: ‘/’ is a-must. Leave out the ‘/’ and it will not work.
#Aliasing later HW following
Require all granted #Apache 2.4 syntax
Works OK so far…..( Keeping everything intact )