{"id":125,"date":"2008-09-16T00:40:07","date_gmt":"2008-09-15T19:10:07","guid":{"rendered":"http:\/\/www.bin-co.com\/blog\/?p=125"},"modified":"2008-09-16T00:40:07","modified_gmt":"2008-09-15T19:10:07","slug":"installing-lampapache-web-serverphpmysql-in-debian","status":"publish","type":"post","link":"https:\/\/www.bin-co.com\/blog\/2008\/09\/installing-lampapache-web-serverphpmysql-in-debian\/","title":{"rendered":"Installing LAMP(Apache Web Server\/PHP\/MySQL) in Debian\/Ubuntu"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bin-co.com\/blog\/wp-content\/uploads\/2008\/09\/lava_lamp.jpg\" alt=\"LAMP - Linux, Apache, MySQL, PHP\" title=\"Lamp\" width=\"232\" height=\"294\" class=\"size-full wp-image-128 intro\" align=\"right\" \/><\/p>\n<p class=\"intro\">Installing the <abbr title=\"Linux Apache MySQL PHP\">LAMP<\/abbr> environment on a Linux system is easy if you are comfortable with using the native package management software. If you on a Red Hat\/Fedora\/CentOS system, that will be yum &#8211; and for Debian\/Ubuntu systems, that will be apt. This tutorial shows you how to install Apache 2, PHP 5 and MySQL 5 in Debian using apt.<\/p>\n<p>Before installation, a few points to remember. These instruction are not for a production environment &#8211; this is for a development environment. To install the software, you need root access. You can get that using this command&#8230;<\/p>\n<pre><code class=\"cli\">su -\n[Enter root password]<\/code><\/pre>\n<h2>Installing Apache 2<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bin-co.com\/blog\/wp-content\/uploads\/2008\/09\/apache.png\" alt=\"\" title=\"Apache Logo\" width=\"230\" height=\"90\" class=\"alignnone size-full wp-image-126\" align=\"right\" \/><\/p>\n<p>Use this command to install Apache 2.<\/p>\n<pre><code class=\"javascript\">apt-get install apache2<\/code><\/pre>\n<p>Make sure you specify &#8216;apache2&#8217; &#8211; or else, apache 1.3 will be installed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bin-co.com\/blog\/wp-content\/uploads\/2008\/09\/php-logo-1-1.png\" alt=\"PHP Logo\" title=\"PHP Logo\" width=\"179\" height=\"98\" class=\"alignnone size-full wp-image-123\" align=\"right\" \/><\/p>\n<h2>Install PHP 5<\/h2>\n<p>Now, install the PHP 5 packages&#8230;<\/p>\n<pre><code class=\"javascript\">apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi<\/code><\/pre>\n<p>No go to the folder <code>\/etc\/apache2\/sites-enabled\/<\/code> and edit the file in that directory(usually 000-default). Find the line that says<br \/>\n<code>RedirectMatch ^\/$ \/apache2-default\/<\/code><br \/>\nand remove it.<\/p>\n<p>Now your document root is <code>\/var\/www\/<\/code> &#8211; place all your HTML documents and scripts in this folder. If you want to make some other configuration changes, edit the configuration files at <code>\/etc\/apache2\/apache2.conf<\/code><\/p>\n<p>I also had to make the following changes&#8230;<\/p>\n<ul>\n<li>Changed the owner of <code>\/var\/log\/apache2<\/code> to www-data &#8211; I used the command <code>chown www-data:www-data apache2<\/code><\/li>\n<li>Created an empty file at <code>\/etc\/apache2\/httpd.conf<\/code><\/li>\n<\/ul>\n<p>This was to fix a few errors I saw on my system &#8211; you may not have to do it.<\/p>\n<h2>Install MySQL<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bin-co.com\/blog\/wp-content\/uploads\/2008\/09\/mysql_logo.gif\" alt=\"\" title=\"MySQL Logo\" width=\"150\" height=\"98\" class=\"alignnone size-full wp-image-127\" align=\"right\" \/><\/p>\n<p>This is the command to install MySQL server, its client and PHP&#8217;s MySQL libraries&#8230;<\/p>\n<pre><code class=\"javascript\">apt-get install mysql-client mysql-common mysql-server php5-mysql<\/code><\/pre>\n<p>Finally, Install the other packages you need as well<\/p>\n<pre><code class=\"javascript\">apt-get install php5-sqlite php5-gd ...<\/code><\/pre>\n<h2>Testing the System<\/h2>\n<p>Go to your document root(<code>\/var\/www<\/code>) and create a php files called &#8216;info.php&#8217; and put this code inside that&#8230;<\/p>\n<pre><code class=\"php\">&lt;?php\nphp<!-- PHP bug -->info();\n\n<\/code><\/pre>\n<h3>Start the Servers<\/h3>\n<p>First, turn on the MySQL database server&#8230;<\/p>\n<pre><code class=\"javascript\">\/etc\/init.d\/mysql start<\/code><\/pre>\n<p>Then, start the Apache Web Server&#8230;<\/p>\n<pre><code class=\"javascript\">\/etc\/init.d\/apache2 start<\/code><\/pre>\n<p>Now fire up a browser and go to <a href=\"http:\/\/localhost\/\">localhost<\/a> &#8211; you should see a file listing page with a &#8216;info.php&#8217; in the list. Click on that link &#8211; if you see a PHP information page, your web server is setup correctly.<\/p>\n<p>To make sure MySQL-PHP connection is working, <a href=\"http:\/\/www.bin-co.com\/database\/clients\/phpmyadmin\/installing_phpmyadmin.php\">install phpMyAdmin<\/a> &#8211; or write a database connection script &#8211; whatever is easier for you.<\/p>\n<h2>Related Links<\/h2>\n<ul>\n<li><a href=\"http:\/\/www.thegeekstuff.com\/2008\/09\/how-to-install-or-upgrade-lamp-apache-mysql-and-php-stack-on-linux-using-yum\/\">How To Install Or Upgrade LAMP: Linux, Apache, MySQL and PHP Stack Using Yum<\/a><\/li>\n<li><a href=\"http:\/\/www.debianadmin.com\/apache2-installation-and-configuration-with-php-support-in-debian-linux.html\">Apache2 installation and configuration with php support<\/a><\/li>\n<li><a href=\"http:\/\/www.debianadmin.com\/install-and-configure-apache2-with-php5-and-ssl-support-in-debian-etch.html\">Install and Configure Apache2 with PHP5 and SSL Support in Debian Etch<\/a><\/li>\n<li><a href=\"http:\/\/www.adobe.com\/devnet\/dreamweaver\/articles\/lamp.html\">Setting Up Your PHP Server Environment Using Linux, Apache, MySQL, and PHP<\/a><\/li>\n<li><a href=\"http:\/\/www.mysql-apache-php.com\/\">Quick Linux Server w\/ Apache+PHP+MySQL<\/a><\/li>\n<li><a href=\"http:\/\/www.debianhelp.co.uk\/lamp.htm\">LAMP (Linux Apache Mysql PHP) Configuration and Installing in Debian<\/a><\/li>\n<li><a href=\"http:\/\/lamphowto.com\/\">HOWTO: Installing MySQL and Apache with PHP support on Linux<\/a><\/li>\n<li><a href=\"http:\/\/www.kewanshunn.com\/articles\/how_to_install_apache2,_php5,_mysql5_on_redhat\/3.html\">How to install Apache2, PHP5, MySQL5 on RedHat<\/a><\/li>\n<\/ul>\n<p><strong>Shameless Plug<\/strong>: If you are a Linux user, you may want to check out my <a href=\"http:\/\/lindesk.com\/\">Linux Blog &#8211; LinDesk<\/a> &#8211; its about Linux on the Desktop &#8211; Articles, Application Reviews and Tutorials about many aspects of Linux included configuration and scripting.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Installing the <abbr title=\"Linux Apache MySQL PHP\">LAMP<\/abbr> environment on a Linux system is easy if you are comfortable with using the native package management software. If you on a Red Hat\/Fedora\/CentOS system, that will be yum &#8211; and for Debian\/Ubuntu systems, that will be apt. This tutorial shows you how to install Apache 2, PHP 5 and MySQL 5 in Debian using apt.<\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10,16,21,30],"tags":[43,47,88,89,147,161,173,188,210,252],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-apache","category-database","category-linux","category-php","category-web-development","tag-apache","tag-apt","tag-database","tag-debian","tag-install","tag-lamp","tag-linux","tag-mysql","tag-php","tag-server"],"_links":{"self":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/comments?post=125"}],"version-history":[{"count":0,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}