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.
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.
See http://www.php.net/manual/en/install.unix.apache2.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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:
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:
If everytjhing works, you'll have a beautiful web page describing your apache/php configuration, modules loaded and so on...
Regards
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
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();
?>
And try to call http://your.server/test.phpIf everytjhing works, you'll have a beautiful web page describing your apache/php configuration, modules loaded and so on...
Regards