更改apache DocumentRoot后PHP无法正常工作

I have just setup the LAMP server on Debian. The initial tests were fine. After that, I've decided to change the home directory from "/var/www/" to something like "/home/user/public_html/". I did this changes in "/etc/apache2/sites-available/default".

The problem I am facing now is, that the PHP does not work in the new home folder. PHP sites are now parsed as text files and I can see the full source in browser (when clicking on view page source).

What can I do, that the PHP will also work under that path (and not only under /var/www)?

Look in php.ini in your php folder. There should be entries to change to 'doc_root' as well as 'extension_dir'. Make sure these are set, then restart Apache and it should work.