• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Test The PHP Configuration on Apache and Nginx Web Servers In CentOS 7.6

  • 00:32 netstat -tulpn | grep http
  • 00:37 netstat -tulpn | grep nginx
  • 00:50 yum install php php-fpm php-mysql php-gd php-opcache php-apcu php-pecl-zip php-pecl-memcached php-pecl-memcache -y
  • 01:03 cd /var/www/html
  • 01:09 vim info.php
  • 01:22 systemctl restart httpd
  • 01:47 systemctl enable php-fpm
  • 01:52 systemctl start php-fpm
  • 02:04 vim /etc/php.ini
  • 02:27 vim /etc/php-fpm.d/www.conf
  • 03:05 cd /etc/nginx/conf.d/
  • 03:16 vim php.conf
  • 03:40 cd /usr/share/nginx/html
  • 03:47 vim info.php
  • 04:00 systemctl restart php-fpm
  • 04:05 nginx -t
  • 04:10 systemctl restart nginx
5766

Test the configuration of PHP On Apache And Nginx Web Servers In CentOS 7.6

PHP Configuration Test On Apache.

Check the version of Apache And nginx Web server

[root@linuxhelp ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 24 2019 13:45:48
[root@linuxhelp ~]# nginx -v
nginx version: nginx/1.17.0

verify the port numbers of Apache And nginx Webservers.

[root@linuxhelp ~]# netstat -tulpn | grep httpd
tcp6       0      0 :::80                   :::*                    LISTEN      1414/httpd      
 [root@linuxhelp ~]# netstat -tulpn | grep nginx
tcp        0      0 0.0.0.0:8989            0.0.0.0:*               LISTEN      32344/nginx: master 
tcp6       0      0 :::8989                 :::*                    LISTEN      32344/nginx: master 

Install the required php modules as follows:

[root@linuxhelp ~]# yum install php php-fpm php-mysql php-gd php-opcache php-apcu php-pecl-zip php-pecl-memcached php-pecl-memcache -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.horizon.vn
 * epel: mirror1.ku.ac.th
 * extras: mirror.horizon.vn
 * remi-php72: mirrors.neterra.net
 * remi-safe: mirrors.neterra.net
 * updates: centos-hcm.viettelidc.com.vn
Package php-mysql-5.4.16-46.el7.x86_64 is obsoleted by php-mysqlnd-7.2.17-1.el7.remi.x86_64 which is already installed
Package php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64 already installed and latest version
Resolving Dependencies
.
.
.
.

Dependency Updated:
  php-cli.x86_64 0:7.2.19-2.el7.remi               php-common.x86_64 0:7.2.19-2.el7.remi            
  php-json.x86_64 0:7.2.19-2.el7.remi              php-mbstring.x86_64 0:7.2.19-2.el7.remi          
  php-mysqlnd.x86_64 0:7.2.19-2.el7.remi           php-pdo.x86_64 0:7.2.19-2.el7.remi               
  php-xml.x86_64 0:7.2.19-2.el7.remi              

Complete!

Change the directory to Apache’s Document Root directory to create a file for viewing the php settings

[root@linuxhelp ~]# cd /var/www/html
[root@linuxhelp html]# vim info.php
 <?php
phpinfo();
?>

Restart the service of Apache

[root@linuxhelp html]# systemctl restart httpd

Open the Browser, Enter the url followed by the info.php snap (1)

PHP Configuration Test On Nginx:

Enable the service of php-fpm.

[root@linuxhelp html]# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

Start the service of php-fpm.

[root@linuxhelp html]# systemctl start php-fpm

Edit the configuration file of PHP

[root@linuxhelp html]# vim /etc/php.ini
cgi.fix_pathinfo=0

Modify the configuration of php-fpm as follows:

[root@linuxhelp html]# vim /etc/php-fpm.d/www.conf
user=nginx
group=nginx
listen.owner=nginx
listen.group=nginx

Change the directory to nginx customised Configuration file

[root@linuxhelp html]# cd /etc/nginx/conf.d/

Create a virtual host named php.conf

[root@linuxhelp conf.d]# vim php.conf
server {

listen 8989;
server_name 192.168.7.229;
root /usr/share/nginx/html;
index index.php;
 location ~* \.php$ {
      fastcgi_pass 127.0.0.1:9000;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}

Change the directory to Nginx Document root directory to create a file to view the php settings

[root@linuxhelp conf.d]# cd /usr/share/nginx/html
[root@linuxhelp html]# vim info.php
<?php
Phpinfo();
?>

Restart the service of php-fpm

[root@linuxhelp html]# systemctl restart php-fpm

Test the Configuration of nginx

[root@linuxhelp html]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart the service of nginx

[root@linuxhelp html]# systemctl restart nginx.

Open the browser and enter the servername with its appropriate port number followed by info.php

snap (2) With this,PHP Configuration Test on Apache And Nginx Web Servers in CentOS 7.6 comes to end.

Tags:
caden
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is the main configuration file of php?

A

/etc/php.ini is the configuration file of php

Q

What is the full form of php-fpm?

A

the full form of php-fpm is PHP-FastCGI Process Manager.

Q

WHat does php-fpm allow?

A

php-fpm allows a website to handle high loads.

Q

What is php cgi?

A

CGI stands for Common gateway interface which is a web technology and protocol that defines a way for a web server to interact with external applications.

Q

What is fastcgi_pass?

A

FastCGI is a programming interface that can speed up web applications.

Related Tutorials in How to Test The PHP Configuration on Apache and Nginx Web Servers In CentOS 7.6

Related Tutorials in How to Test The PHP Configuration on Apache and Nginx Web Servers In CentOS 7.6

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Test The PHP Configuration on Apache and Nginx Web Servers In CentOS 7.6

Related Forums in How to Test The PHP Configuration on Apache and Nginx Web Servers In CentOS 7.6

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ganesh Konka ?
Zentya 6.1 http proxy configuration

please send link for creating zentyal 6.1 for http proxy and firewall as gateway.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.