{"id":126,"date":"2018-04-24T17:30:45","date_gmt":"2018-04-24T15:30:45","guid":{"rendered":"https:\/\/ubuntu.dirkschmidtke.de\/?post_type=portfolio&#038;p=126"},"modified":"2025-03-19T10:15:36","modified_gmt":"2025-03-19T09:15:36","slug":"lamp-server","status":"publish","type":"portfolio","link":"https:\/\/ubuntu.dirkschmidtke.de\/en\/portfolio\/lamp-server-stack\/","title":{"rendered":"LAMP server stack"},"content":{"rendered":"<p>The abbreviation LAMP stands for <strong>L<\/strong>inux, the web server <strong>A<\/strong>pache, the database <strong>M<\/strong>ySQL (or <strong>M<\/strong>ariaDB) and the scripting language <strong>P<\/strong>HP (or <strong>P<\/strong>ython, <strong>P<\/strong>erl).<\/p>\n<p>In contrast to Debian, Ubuntu continues to rely on Oracle&#8217;s open source edition of the MySQL server instead of using the MariaDB fork.<\/p>\n<p>Thanks to the magic of the Debian\/Ubuntu package manager <a title=\"Apt im Debian-Wiki\" href=\"http:\/\/wiki.debian.org\/Apt\">Apt<\/a>, a short command line is enough to quickly set up a complete web server stack with PHP as Apache module and an extension for the database server. Apt will automatically install all additionally required packages (including the base package php-common and some common extensions) and ask for a root password for MySQL. A local web server can then be accessed via a web browser at http:\/\/localhost.<\/p>\n<p>However, in production one might prefer to install PHP-FPM instead of the PHP module, which performs better by reducing the load on the web server. In this case, a one-line command is not quite enough; the proxy module and the configuration file for PHP-FPM must also be provided to complete the installation.<\/p>\n<h3>Installation<\/h3>\n<p>Here is how to install the LAMP stack with PHP as Apache module:<\/p>\n<pre>sudo apt install php-mysql libapache2-mod-php mysql-server<\/pre>\n<p>The more performant variante with PHP-FPM:<\/p>\n<pre>sudo apt install php-fpm php-mysql apache2 mysql-server\r\nsudo a2enmod proxy_fcgi\r\nsudo a2enconf php-fpm\r\nsystemctl reload apache2<\/pre>\n<h3>Installing MariaDb for MySQL<\/h3>\n<p>Debian installs MariaDB even if the admin types <code>apt install mysql-server<\/code> into the console. However, if you want to do without MySQL in Ubuntu, install the package mariadb-server instead of mysql-server.<\/p>\n<h3>Installing an older or newer PHP version<\/h3>\n<p>If you want to install a PHP version other than the one provided by the distribution maintainers, you can rely on the repositories of developer <a href=\"https:\/\/deb.sury.org\/\">Ondrej Sury<\/a>. For Ubuntu, Sury provides a <a href=\"https:\/\/launchpad.net\/~ondrej\/+archive\/ubuntu\/php\/\">PPA<\/a>, which can be integrated as follows:<\/p>\n<pre id=\"yui_3_10_3_1_1712156057997_70\" class=\"command subordinate\">sudo add-apt-repository ppa:ondrej\/php\r\nsudo apt update<\/pre>\n<p>After successful installation of the PPA, you can install other PHP versions by adding the version number to the package names. In the following example, we force PHP 8.2 to replace the PHP version installed by default:<\/p>\n<pre>sudo apt install php8.2-fpm php8.2-mysql\r\nsudo a2disconf php-fpm\r\nsudo a2enconf php8.2-fpm\r\nsystemctl stop php-fpm\r\nsystemctl stop php-fpm &amp;&amp; systemctl disable php-fpm<\/pre>\n<p>First, PHP 8.2 with FPM and the MySQL extension for the new PHP version are installed (this pulls dependencies like php8.2-common; you can install other PHP extensions using the php8.2-extensionname pattern); next, the Apache configuration for the default install of PHP FPM is disabled and the new configuration for PHP 8.2 enabled. Finally, Apache is reloaded to read the new configuration and make it work. It may be necessary to stop old PHP-FPM processes and disable the service so that it won&#8217;t be restartet when rebooting.<\/p>\n<p>eboots zu vermeiden.<\/p>\n<h3>Speicherorte<\/h3>\n<p>Database files for MySQL or MariaDB are stored at \/var\/lib\/mysql\/db_name\/.<\/p>\n<p>The Apache webserver looks for virtual host configurations at \/etc\/apache2\/sites-enabled\/. The Debian (and Ubuntu) way is to store each vhost&#8217;s config at \/etc\/apache2\/sites-available\/vhost_name.conf and symlink it in the \/etc\/apache2\/sites-enabled\/ folder &#8211; either\u00a0 manually or with a little help from the conveniance command <code>a2ensite vhost_name<\/code>.<\/p>\n<p>PHP configuration is stored a php.ini file. There are probably more than one php.ini files on one computer. For example, he right config file for php-fpm and PHP version 8.2 can be found at \/etc\/php\/8.2\/fpm\/php.ini.<\/p>","protected":false},"excerpt":{"rendered":"<p>The abbreviation LAMP stands for Linux, the web server Apache, the database MySQL (or MariaDB) and the scripting language PHP (or Python, Perl). In contrast to Debian, Ubuntu continues to rely on Oracle&#8217;s open source edition of the MySQL server instead of using the MariaDB fork. Thanks to the magic of the Debian\/Ubuntu package manager [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":128,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"portfolio_category":[9],"portfolio_tag":[],"class_list":["post-126","portfolio","type-portfolio","status-publish","has-post-thumbnail","hentry","portfolio_category-web-entwicklung"],"_links":{"self":[{"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/portfolio\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/portfolio"}],"about":[{"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/types\/portfolio"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":16,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/portfolio\/126\/revisions"}],"predecessor-version":[{"id":1004,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/portfolio\/126\/revisions\/1004"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/media\/128"}],"wp:attachment":[{"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"portfolio_category","embeddable":true,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/portfolio_category?post=126"},{"taxonomy":"portfolio_tag","embeddable":true,"href":"https:\/\/ubuntu.dirkschmidtke.de\/en\/wp-json\/wp\/v2\/portfolio_tag?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}