• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Sunday, May 11, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Arch

How to Install PHP 7.3 on an Arch Linux Webserver

How VPS by How VPS
August 8, 2019
in Arch, Uncategorized
0
0
SHARES
112
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Prerequisites
  2. Install PHP 7.3 On Your Webserver
    1. For Apache
    2. For Nginx
  3. Test PHP
  4. Want to contribute?


Prerequisites

  • A Vultr server running up to date Arch Linux (see this article.)
  • A running webserver, either Apache or Nginx
  • Sudo access.
    • Commands required to be ran as root are prefixed by #. The recommended way to run commands as root is to, as a regular user, prefix each of them with sudo.
  • Have a text editor installed, and be familiar with it, such as vi, vim, nano, emacs or a similar editor

Install PHP 7.3 On Your Webserver

Install PHP and FastCGI for PHP:

# pacman -S php-fpm

Visit PHP’s timezone list

Set your timezone. For example, if you chose the category “America” and wanted to use “New_York”, edit /etc/php/php.ini and set the following:

date.timezone = America/New_York

Start FastCGI for PHP, and make it start after every boot:

# systemctl enable --now php-fpm

Configure PHP for your webserver.

For Apache

Create the file /etc/httpd/conf/extra/php-fpm.conf, with the following contents. Make sure to copy this exactly as-is; a common error is putting spaces around the pipe character, but this is not a shell command, and there can be no spaces:

DirectoryIndex index.php index.html
<FilesMatch /.php$>
    SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/"
</FilesMatch>

Allow Apache to use FastCGI by editing /etc/httpd/conf/httpd.conf, and add the following to the end of the LoadModule list:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

To allow using .php files on all websites hosted by Apache, edit /etc/httpd/conf/httpd.conf, and add this to the end. If you’re running multiple host directories; for example, virtual hosts, or separate HTTP/HTTPS directories; and you want to only allow .php files on some of them, edit their configuration files. Within the VirtualHost block, add the following:

Include conf/extra/php-fpm.conf

Finally, restart Apache:

# systemctl restart httpd

For Nginx

Allow Nginx to use FastCGI for PHP by creating the file /etc/nginx/php.conf with the following contents:

# Correctly handle request like /test.php/foo/blah.php or /test.php/
fastcgi_split_path_info ^(.+?/.php)(/.*)$;

try_files $uri $document_root$fastcgi_script_name =404;

# Mitigate <nowiki>https://httpoxy.org/</nowiki> vulnerabilities
fastcgi_param HTTP_PROXY "";

fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

Allow Nginx to use FastCGI by editing /etc/nginx/nginx.conf, and to every server block you want to use PHP with, add the following. Alternatively, if you are using virtual hosts, edit each host’s configuration file:

location ~ /.php$ {
    root         /usr/share/nginx/html/;
    include      php.conf;
}

Restart Nginx:

# systemctl restart nginx

Test PHP

Within the appropriate directory, create test.php with the following contents:

<?php phpinfo(); ?>

In a web browser, visit http://YOUR-SERVER-WEB-ADDRESS-OR-IP/test.php, and you will see a webpage with your PHP version and configuration.

Remember to delete the test.php test file you just created.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How To Install PostgreSQL 11.1 On Arch Linux

Next Post

How to Install Perl 5.28 on an Arch Linux Webserver

Next Post

How to Install Perl 5.28 on an Arch Linux Webserver

Leave a Reply Cancel reply

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

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet