Link to home
Start Free TrialLog in
Avatar of koala-london
koala-london

asked on

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.
Avatar of hernst42
hernst42
Flag of Germany image

ASKER CERTIFIED SOLUTION
Avatar of RizyDeWino
RizyDeWino
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of koala-london
koala-london

ASKER

thanks
Hi,
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:
<?php
phpinfo();
?>

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...

Regards