Skip to main content

Arch Linux + LAMP

Jose CerrejonAbout 1 minLinuxLinux

Arch Linux + LAMP


Lately I suffer distrohopperopen in new window. This has force me to install Manjaroopen in new window, based on Arch Linux and leave a little aside to Debian, with whom I was delighted, but with Manjaro was love at first sight. I did not think that an operating system could be as fast on a computer that is already 4 years.

So back again and configure everything from scratch. This time I've installed Apache+PHP+MariaDB, the trouble is I did not know I was going to give so many headaches.

For this reason, I decided to leave here some notes to configure and have a reference for the future, because several guides that have followed, have not helped me a lot.

Here we go.

First you must to install the required packages:

sudo pacman -S apache php php-apache php-mcrypt mod_fcgid openssl mariadb mariadb-clients

I tried to avoid the AUR repositories to improve system stability.

We configure MariaDB. No matter if your databases are in MySQL or your connections are to this database. It's compatible.

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
mysqladmin -u root password 'mypassword'
systemctl start mysqld

Now modify the file /etc/httpd/conf/httpd.conf (Here it's the majority of problems). I recommend making a copy of the file:

Add # at the beginning of the next line:

LoadModule unique_id_module modules/

Remove # on:

LoadModule rewrite_module modules/
LoadModule ssl_module modules/
LoadModule socache_shmcb_module modules/

Add to section LoadModule:

LoadModule mpm_prefork_module modules/
LoadModule php5_module modules/

Add to section Include:

Include conf/extra/php5_module.conf

Change DocumentRoot and Directory for the project folder, for example:
DocumentRoot "/var/www/my_project/public"
<Directory "/var/www/my_project/public">
php_admin_value open_basedir "/var/www/my_project/public/:/another_dir/:/"

Finally, add at the end of the file:

# Use for PHP 5.x:
LoadModule php5_module modules/
AddHandler php5-script php
Include conf/extra/php5_module.conf
Include conf/extra/httpd-ssl.conf

Modify the file*/etc/php/php.ini*, deleting ; in the next lines:

Restart the process and you are ready to develop or show your site:

systemctl restart httpd
systemctl restart mysqld

If you have problems with Apache or PHP, check your log: /var/log/httpd/error_log