Install LEMP Stack (Nginx, MariaDB, php, phpMyAdmin) on Arch Linux & Manjaro

5a) changes on php.ini Configuration

Edit the /etc/php/php.ini configuration file and un-comment or modify below listed lines which is necessary to run LAMP without issue.

$ sudo nano /etc/php/php.ini

[Set your timezone]
date.timezone = Asia/Kolkata

[Display errors to debug your PHP code]
display_errors = On

[For php-gd extensions]

[Configure MySQL/MariaDB extensions]

[bzip2 extensions]

[mcrypt php extensions]

6) Nginx Configuration

Open /etc/nginx/nginx.conf file on your favorite text editor and change worker_processes values according your CPU count. For CPU count use lscpu command. I’m having 4 CPU’s that’s why i added 4. Also check Nginx User, it should be http. We need to tell nginx to run php using php-fpm. Also add/modify below colored lines on your file. I have removed all the unwanted lines from this file for clear explanation. Mention your FQDN ( instead of us.

$ nano /etc/nginx/nginx.conf

worker_processes 4;


        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm index.php;

location ~ \.php$ {
      fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
      fastcgi_index  index.php;
      root   /usr/share/nginx/html;
      include        fastcgi.conf;

Create test php file to check whether php is working with apache or not.

[Creating php info file]
$ sudo nano /usr/share/nginx/html/phpinfo.php
<?php phpinfo(); ?>

[Restart Nginx service]
$ sudo systemctl restart nginx.service

[Restart php-fpm service]
$ sudo systemctl restart php-fpm

Run nginx configuration test

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Open your web browser and navigate to http://localhost/phpinfo.php or http://your-server-ip-address/phpinfo.php or

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *