I have installed all the necessary servers to work with php in Ubuntu..

But i don't know how to compile php in Linux.

My hostname is "blackparrot" my user name is "red"

Pls tell or show me a way to compile php here

  • If you just installed PHP, Apache, and MySQL via LAMP, you don't need to compile PHP. Is there a reason you want to do that? – Thomas Ward Mar 24 '13 at 16:49

You don't need to compile PHP if you already installed LAMP as PHP is run in the server itself, you need just to invoke the files in the proper place as @MustafaJF mention.

Simply open nautilus with administrative privileges by executing (in a terminal or by hitting Alt-F2 for the run program dialog), write gksudo nautilus, provide your password and go to the /var/www folder, over there simply drop your php files which you can access later by opening a web browser and pointing to the http://localhost/foldername/yourphpfile.php address.

Where foldername is the folder where the php files will reside and yourphpfile.php is the file containing your php code.

A good example to test if everything is running fine is the to create a file with the next contents inside:


Let's name this file phpinfo.php and place it at the very root of /var/www folder, after which we'll invoke it via http://localhost/phpinfo.php and will result in something like this:

enter image description here

Results may vary from case to case.

Remember that /var/www is a protected place of which you will need administrative privileges each time you want to access the files for a change or something. But if you prefer, you can (at your own risk) change the location of your /var/www to a different place for testing purposes, which will suppose no risk at all if you do it just for testing purposes and have your server not exposed to the net. See this answer for a workaround to change the default location of your testing server.

Please inform if you are experiencing any issues.

Good luck!


There is a sub folder under your apache folder.

It is usually named www.

You put all your website files under that folder and call the site through the web browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.