Ubuntu – How to compile php in after installing php, apache and thesql severs

lampPHPserver

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

Best Answer

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:

<?php
 phpinfo();
?>

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!