Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by ChrisPepper: http://wiki.apache.org/httpd/ScratchPad/DebianPHP The comment on the change is: Major cleanup ------------------------------------------------------------------------------ == Installing Apache 2 and PHP 5 on Debian == - Lately a lot of folks on #Apache requested help with the installation of Apache 2[.2] and PHP 5 on a Debian[-based] system. + Lately a lot of folks on #Apache have requested help with installation of Apache 2[.2] and PHP 5 on Debian-based systems. - Even though this is a rather straight forward process, we have so far neglected to documented it. This is the purpose of this wiki page: To serve our lazyness. + Even though this is a rather straightforward process, we have so far neglected to document it. This page provides that docucumentation. === Preparing your system === Before getting started, you should prepare your system, and before preparing your system, you should prepare yourself. - You should know: What do you want to achieve? What technology is best fit to achieve that goal? What constraints are there? + You should know: What do you want to achieve? What technology is best to achieve that goal? What constraints are there? - Now that you know that you want to create a ''representative appearance on the web'', using ''Apache 2'', ''PHP 5'' and ''MySQL'' as technologies, that your ''limited knowledge'' is your only constraint and that this wiki page will help you eliminate it, you can start preparing your system by typing [either as ''root'', or with ''sudo'' infront of it]: + Now that you know that you want to create a website, using ''Apache 2'', ''PHP 5'' and MySQL, that your knowledge is your only constraint, and that this wiki will help you learn more, you can start preparing your system by typing [either as ''root'', or prefixed with ''sudo'']: {{{ apt-get update }}} - This will download the latest lists of packages, to make sure you also install the latest version of the software. + This will download the latest lists of packages, to make sure you install the current versions of the software. === Installing the Software === - Installing then the required packages is as straight forward as installing any other package on Debian, the trick is knowing what packages you need: + Installing the required packages is as straightforward as installing any other package on Debian; the trick is knowing what packages you need: {{{ apt-get install apache2-mpm-prefork libapache2-mod-php5 }}} - This should actually suffice. Debian's packagemangement system should now automatically chose the missing packages which need to be installed. + This should actually suffice. Debian's package mangement system should now automatically chose the missing packages which need to be installed. - If you're running the latest version of Debian [as of this writing: Etch], you might want to install also the latest [and best] version of apache, by explicitly specifying + If you're running the latest version of Debian [as of this writing: Etch], you might want to also install the latest [and best] version of apache, by explicitly specifying ''apache2.2-common'' in the above install command. If you also need MySQL, adding ''php5-mysql'' and ''mysql-server-5.0'', should do the rest of the magic. - After the install is done, and was successful, hitting ''http://localhost/'' in your browser should prove that you now have a running web server. + After that install is complete, visiting ''http://localhost/'' in your browser should prove that you now have a running web server. === Configuring PHP === - As Debian is trying to be an extra friendly distro, it splits a single package up in all possible and impossible modules. + As Debian is trying to extra-friendly, it splits a single package up into all possible and impossible modules. - In Apache's case those modules are called ''libapache2-mod-something'' and their configuration files are saved in ''/etc/apache2/mods-available''. To enable it, you'd type something like: + In Apache's case those modules are called ''libapache2-mod-something'' and their configuration files are saved in ''/etc/apache2/mods-available''. To enable a module, you'd type something like: {{{ a2enmod php5 }}} Which will simply symlink ''/etc/apache2/mods-available/php5.conf'' and ''/etc/apache2/mods-available/php5.load'' to ''/etc/apache2/mods-enabled/''. - You're half done now. The last two things that need to be taken care of is to '''correct''' Debian's [and php.net's] default PHP configuration for Apache. You can do this by typing: + You're half done now. The last two things that need to be taken care of are to '''correct''' Debian's [and php.net's] default PHP configuration for Apache. You can do this by typing: {{{ sed -r 's/AddType/AddHandler/g' -i /etc/apache2/mods-available/php5.conf }}} - And now you'll have to tell Apache to finally reload it's configuration and thus enable PHP: + And now you'll have to tell Apache to reload its configuration and thus enable PHP: {{{ /etc/init.d/apache2 restart }}} @@ -51, +51 @@ That's it. You should now be able to run PHP scripts on your newly installed web server. === Resources === + [["Info/DistrosDefaultLayout"]] In order to become familiar with your new Debian-based Apache symstem you should read this. Also you may be surprised that the Debian folks not only make odd changes to the installation, but fortunately document them well. In ''/usr/share/doc/apache2/'' You should find most of the documentation you need. - [["Info/DistrosDefaultLayout"]] In order to become familiar with your new Debian-based Apache symstem you should read this. Also you will be very surprised that the Debian folks not only make weird changes to make your life harder but also document it very well: - In ''/usr/share/doc/apache2/'' You should find most of the documentation you need.
