VirtualDocumentRoot /home/%0/public_html does not work

I have followed the steps here but this does not work.

It adds the VirtualDocumentRoot /home/%0/public_html to the end of the /etc/httpd/conf/httpd.conf file but when I try to go to I get

You don’t have permission to access /~USERNAME/ on this server.

This is a server that is to be used for a coding class, so we don’t have actual dns for domains on here, we need a simple way for students to be able to view their sites.

I tried just using UserDir public_html which works, but php files do not work.

Really need this solution to work.

Any help is appreciated.