How to configure apache for php on Linux

Hi there,

I am new to php and trying to install php on linux. I just install apache and php on my ubuntu and i know i need to modify apache config but don't know how.

could you please tell me how to do it.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

check "Edit the Apache Configuration File (httpd.conf)" section at below link :

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
koala-londonAuthor Commented:
Use what your Linux distribution offers. Following instructions from php's or apache's web site is a mistake. They'll probably tell you how to get the last release, compile, install and so on.
When using a packaged linux distribution, it's already done for you.
Furthermore, when a security patch is released, you get it almost automatically. When a new release is made (from Ubuntu), you get it too. Your system is up-to-date and the most secure. Installing PHP or apache manually, then let it live (ie, never upgrade it) is a major security risk, provided your web server is public.

Anyway, the most simple way with Ubuntu is:
sudo aptitude install apache2 php5 libapache2-mod-php5

Open in new window

If apache is already installed, no problem.
The last one is the one that installs and configures PHP for apache.
After that, it should work out-of-the-box

Create in your "DocumentRoot" (probably /var/www or /srv/www if you didn't change your apache configuration) a file called test.php, containing:

Open in new window

And try to call http://your.server/test.php
If everytjhing works, you'll have a beautiful web page describing your apache/php configuration, modules loaded and so on...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.