How to switch between PHP versions on Ubuntu Nginx
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have PHP 7.0 and 7.2 installed.
For now, I use PHP 7.0.
How can I switch to PHP 7.2?
php-7 nginx ubuntu
add a comment |
I have PHP 7.0 and 7.2 installed.
For now, I use PHP 7.0.
How can I switch to PHP 7.2?
php-7 nginx ubuntu
add a comment |
I have PHP 7.0 and 7.2 installed.
For now, I use PHP 7.0.
How can I switch to PHP 7.2?
php-7 nginx ubuntu
I have PHP 7.0 and 7.2 installed.
For now, I use PHP 7.0.
How can I switch to PHP 7.2?
php-7 nginx ubuntu
php-7 nginx ubuntu
asked 1 hour ago
RufusRufus
1468
1468
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service.
Take a backup of the default configuration file and then open it up in your favourite text editor.
$ cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
$ sudo vim /etc/nginx/sites-available/default
Change the FastCGI backend to use the new PHP-FPM socket, save and exit the file
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
Run the configuration test
$ nginx -t
Restart the web server
$ sudo service nginx restart
For more information visit here
add a comment |
Please use to below command
sudo update-alternatives --config php
After run above command select the PHP version that you need to use.
Press to keep the current choice[*], or type selection number: For example 2
After switching below command used to restart the PHP and Nginx server.
sudo service nginx restart
sudo service php7.1-fpm or php7.2-fpm restart
Please try above code. If you have any help let me know.
add a comment |
sudo a2dismod php7.0<br>
sudo a2enmod php7.2<br>
sudo systemctl restart apache2
Reference: Link
nginx? not apache
– Prathap Gunasekaran
7 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272815%2fhow-to-switch-between-php-versions-on-ubuntu-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service.
Take a backup of the default configuration file and then open it up in your favourite text editor.
$ cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
$ sudo vim /etc/nginx/sites-available/default
Change the FastCGI backend to use the new PHP-FPM socket, save and exit the file
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
Run the configuration test
$ nginx -t
Restart the web server
$ sudo service nginx restart
For more information visit here
add a comment |
For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service.
Take a backup of the default configuration file and then open it up in your favourite text editor.
$ cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
$ sudo vim /etc/nginx/sites-available/default
Change the FastCGI backend to use the new PHP-FPM socket, save and exit the file
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
Run the configuration test
$ nginx -t
Restart the web server
$ sudo service nginx restart
For more information visit here
add a comment |
For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service.
Take a backup of the default configuration file and then open it up in your favourite text editor.
$ cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
$ sudo vim /etc/nginx/sites-available/default
Change the FastCGI backend to use the new PHP-FPM socket, save and exit the file
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
Run the configuration test
$ nginx -t
Restart the web server
$ sudo service nginx restart
For more information visit here
For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service.
Take a backup of the default configuration file and then open it up in your favourite text editor.
$ cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
$ sudo vim /etc/nginx/sites-available/default
Change the FastCGI backend to use the new PHP-FPM socket, save and exit the file
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
Run the configuration test
$ nginx -t
Restart the web server
$ sudo service nginx restart
For more information visit here
answered 52 mins ago
Prathap GunasekaranPrathap Gunasekaran
2,1191619
2,1191619
add a comment |
add a comment |
Please use to below command
sudo update-alternatives --config php
After run above command select the PHP version that you need to use.
Press to keep the current choice[*], or type selection number: For example 2
After switching below command used to restart the PHP and Nginx server.
sudo service nginx restart
sudo service php7.1-fpm or php7.2-fpm restart
Please try above code. If you have any help let me know.
add a comment |
Please use to below command
sudo update-alternatives --config php
After run above command select the PHP version that you need to use.
Press to keep the current choice[*], or type selection number: For example 2
After switching below command used to restart the PHP and Nginx server.
sudo service nginx restart
sudo service php7.1-fpm or php7.2-fpm restart
Please try above code. If you have any help let me know.
add a comment |
Please use to below command
sudo update-alternatives --config php
After run above command select the PHP version that you need to use.
Press to keep the current choice[*], or type selection number: For example 2
After switching below command used to restart the PHP and Nginx server.
sudo service nginx restart
sudo service php7.1-fpm or php7.2-fpm restart
Please try above code. If you have any help let me know.
Please use to below command
sudo update-alternatives --config php
After run above command select the PHP version that you need to use.
Press to keep the current choice[*], or type selection number: For example 2
After switching below command used to restart the PHP and Nginx server.
sudo service nginx restart
sudo service php7.1-fpm or php7.2-fpm restart
Please try above code. If you have any help let me know.
edited 50 mins ago
answered 55 mins ago
Kamlesh SolankiKamlesh Solanki
25416
25416
add a comment |
add a comment |
sudo a2dismod php7.0<br>
sudo a2enmod php7.2<br>
sudo systemctl restart apache2
Reference: Link
nginx? not apache
– Prathap Gunasekaran
7 mins ago
add a comment |
sudo a2dismod php7.0<br>
sudo a2enmod php7.2<br>
sudo systemctl restart apache2
Reference: Link
nginx? not apache
– Prathap Gunasekaran
7 mins ago
add a comment |
sudo a2dismod php7.0<br>
sudo a2enmod php7.2<br>
sudo systemctl restart apache2
Reference: Link
sudo a2dismod php7.0<br>
sudo a2enmod php7.2<br>
sudo systemctl restart apache2
Reference: Link
edited 18 mins ago
Rakesh Donga
2,716317
2,716317
answered 28 mins ago
Hafiz ArslanHafiz Arslan
17512
17512
nginx? not apache
– Prathap Gunasekaran
7 mins ago
add a comment |
nginx? not apache
– Prathap Gunasekaran
7 mins ago
nginx? not apache
– Prathap Gunasekaran
7 mins ago
nginx? not apache
– Prathap Gunasekaran
7 mins ago
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272815%2fhow-to-switch-between-php-versions-on-ubuntu-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown