Php -v and php-fpm -v show different versions of php

phpfpmversionsmultipleubuntuispconfigfastcgiversionusecentosapacheserveronerun83

Last Update : 2023-09-22 UTC 08:18:42 AM

Answers of > Php -v and php-fpm -v show different versions of php

Finally, restart the Apache service to w3coded ispconfig apache implement your changes:,You have now combined w3coded ispconfig apache virtual hosts and PHP-FPM to serve multiple w3coded ispconfig apache websites and multiple versions of PHP on a w3coded ispconfig apache single server. The only practical limit on the w3coded ispconfig apache number of PHP sites and PHP versions that your w3coded ispconfig apache Apache service can handle is the processing w3coded ispconfig apache power of your instance.,First create a new w3coded ispconfig apache virtual host configuration file for the website w3coded ispconfig apache site1.your_domain. Here you will direct Apache w3coded ispconfig apache to render content using php7.3:,DigitalOcean w3coded ispconfig apache makes it simple to launch in the cloud and scale w3coded ispconfig apache up as you grow – whether you’re running one w3coded ispconfig apache virtual machine or ten thousand.

You can add the both repository to your system using the below commands:

sudo dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

First let’s discover what versions of PHP 7 are available on Remi:

sudo dnf module list php

You’ll see an output like this:

OutputRemi's Modular repository for Enterprise Linux 8 - x86_64
Name                     Stream                       Profiles                                       Summary                                   
php                      remi-7.2                     common [d], devel, minimal                     PHP scripting language                    
php                      remi-7.3                     common [d], devel, minimal                     PHP scripting language                    
php                      remi-7.4                     common [d], devel, minimal                     PHP scripting language                    

Next, disable the default PHP module and enable Remi’s PHP7.3 module using the below command:

sudo dnf module reset php
sudo dnf module enable php:remi-7.3

Lets start to installing php73 and php73-php-fpm:

sudo dnf install php73 php73-php-fpm -y

Now repeat the process for PHP version 7.4. Install php74 and php74-php-fpm.

sudo dnf module reset php
sudo dnf module enable php:remi-7.4
sudo dnf install php74 php74-php-fpm -y

After installing both PHP versions, start the php73-php-fpm service and enable it to start at boot with the following commands:

sudo systemctl start php73-php-fpm
sudo systemctl enable php73-php-fpm

Next, verify the status of php73-php-fpm service with the following commands:

sudo systemctl status php73-php-fpm

You’ll see the following output:

● php73-php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php73-php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-04-22 05:14:46 UTC; 52s ago
 Main PID: 14206 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
    Tasks: 6 (limit: 5059)
   Memory: 25.9M
   CGroup: /system.slice/php73-php-fpm.service
           ├─14206 php-fpm: master process (/etc/opt/remi/php73/php-fpm.conf)
           ├─14207 php-fpm: pool www
           ├─14208 php-fpm: pool www
           ├─14209 php-fpm: pool www
           ├─14210 php-fpm: pool www
           └─14211 php-fpm: pool www

Apr 22 05:14:46 centos-s-1vcpu-1gb-nyc3-01 systemd[1]: Starting The PHP FastCGI Process Manager...
Apr 22 05:14:46 centos-s-1vcpu-1gb-nyc3-01 systemd[1]: Started The PHP FastCGI Process Manager.

Repeating this process, now start the php74-php-fpm service and enable it to start at boot with the following commands:

sudo systemctl start php74-php-fpm
sudo systemctl enable php74-php-fpm

And then verify the status of php74-php-fpm service with the following commands:

sudo systemctl status php74-php-fpm

You’ll see the following output:

● php74-php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php74-php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-04-22 05:16:16 UTC; 23s ago
 Main PID: 14244 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
    Tasks: 6 (limit: 5059)
   Memory: 18.8M
   CGroup: /system.slice/php74-php-fpm.service
           ├─14244 php-fpm: master process (/etc/opt/remi/php74/php-fpm.conf)
           ├─14245 php-fpm: pool www
           ├─14246 php-fpm: pool www
           ├─14247 php-fpm: pool www
           ├─14248 php-fpm: pool www
           └─14249 php-fpm: pool www

Apr 22 05:16:15 centos-s-1vcpu-1gb-nyc3-01 systemd[1]: Starting The PHP FastCGI Process Manager...
Apr 22 05:16:16 centos-s-1vcpu-1gb-nyc3-01 systemd[1]: Started The PHP FastCGI Process Manager.

First, create document root directories for both site1.yourdomain and site2.yourdomain:

sudo mkdir /var/www/site1.your_domain
sudo mkdir /var/www/site2.your_domain

By default, Apache webserver runs as a apache user and apache group. To ensure that you have the correct ownership and permissions of your website root directories, execute the following commands:

sudo chown -R apache:apache /var/www/site1.your_domain
sudo chown -R apache:apache /var/www/site2.your_domain
sudo chmod -R 755 /var/www/site1.your_domain
sudo chmod -R 755 /var/www/site2.your_domain

Next you will create an info.php file inside each website root directory. This will display each website’s PHP version information. Begin with site1:

sudo vi /var/www/site1.your_domain/info.php

<?php phpinfo(); ?>

Save and close the file. Now copy the info.php file you created to site2:

sudo cp /var/www/site1.your_domain/info.php /var/www/site2.your_domain/info.php

First create a new virtual host configuration file for the website site1.your_domain. Here you will direct Apache to render content using php7.3:

sudo vi /etc/httpd/conf.d/site1.your_domain.conf

<VirtualHost *:80>
     ServerAdmin admin@site1.your_domain
     ServerName site1.your_domain
     DocumentRoot /var/www/site1.your_domain
     DirectoryIndex info.php
     ErrorLog /var/log/httpd/site1.your_domain-error.log
     CustomLog /var/log/httpd/site1.your_domain-access.log combined

  <IfModule !mod_php7.c>
    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/var/opt/remi/php73/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>

</VirtualHost>

Next, create a new virtual host configuration file for the website site2.your_domain. You will specify this subdomain to deploy php7.4:

sudo vi /etc/httpd/conf.d/site2.your_domain.conf

<VirtualHost *:80>
     ServerAdmin admin@site2.your_domain
     ServerName site2.your_domain
     DocumentRoot /var/www/site2.your_domain
     DirectoryIndex info.php
     ErrorLog /var/log/httpd/site2.your_domain-error.log
     CustomLog /var/log/httpd/site2.your_domain-access.log combined
  <IfModule !mod_php7.c>
    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/var/opt/remi/php74/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>

</VirtualHost>

Save and close the file when you are finished. Then, check the Apache configuration file for any syntax errors with the following command:

sudo apachectl configtest

You’ll see an output printing Syntax OK:

OutputSyntax OK

Finally, restart the Apache service to implement your changes:

sudo systemctl restart httpd

Now that you’ve tested your sites, remove the info.php files. Because they contain sensitive information about your server and are accessible to unauthorized users, they pose a security vulnerability. To remove both files, run the following commands:

sudo rm -rf /var/www/site1.your_domain/info.php
sudo rm -rf /var/www/site2.your_domain/info.php

Current topics : Php -v and php-fpm -v show different versions of php

Newly Added Questions

Similar Questions

Questions :

How To Group Array Key Value

Last Update : 2023-09-22 UTC 12:52:12 PM

Questions :

PhpStorm Warning For React Attributes In Jsx File With SCSS File

Last Update : 2023-09-22 UTC 12:52:06 PM

Questions :

Why Is The File Not Showing Up In Request.files And In Request.forms Instead?

Last Update : 2023-09-22 UTC 12:51:56 PM

Questions :

Proxying Assets From React App Directory In Slim Framework?

Last Update : 2023-09-22 UTC 12:51:47 PM

Questions :

Laravel 5.4 Can't Run “php Artisan Preset React” Comand

Last Update : 2023-09-22 UTC 12:51:30 PM

Questions :

How To Update Session Values Without Signing Out?

Last Update : 2023-09-22 UTC 12:51:10 PM

Questions :

Array Is Not Visible

Last Update : 2023-09-22 UTC 12:51:00 PM

Questions :

React Routing For Login Using Symfony

Last Update : 2023-09-22 UTC 12:50:42 PM

Questions :

Sanctum With React SPA Returning 419 Page Expired

Last Update : 2023-09-22 UTC 12:50:24 PM

Questions :

How Do I Import An Input String Into Another Page

Last Update : 2023-09-22 UTC 12:50:07 PM

Top
© 2023 W3CODED - All Rights Reserved.