Run PHP and CGI programs in Ubuntu

You might have suffered from the problem of executing/running PHP or CGI programs in Ubuntu. For all your problems, here is the solution.


Steps to run php programs :--


  • Open terminal and type sudo chmod -R 777 /var/www



  • Now create a folder with the name php.



  • Place your html files in /var/www folder and php files in /var/www/php folder.



Steps to run CGI programs :--




  • Open terminal and type sudo chmod -R 777 /usr/lib/cgi-bin



  • Now place your .cgi or .pl files in cgi-bin folder.



  • Now open your browser and type http://localhost/cgi-bin/programname.cgi


Thank you :)