{"id":279,"date":"2021-10-20T04:47:38","date_gmt":"2021-10-20T04:47:38","guid":{"rendered":"http:\/\/wyattsanders.com\/?p=279"},"modified":"2021-10-26T05:56:52","modified_gmt":"2021-10-26T05:56:52","slug":"i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10","status":"publish","type":"post","link":"https:\/\/wyattsanders.com\/es\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/","title":{"rendered":"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10"},"content":{"rendered":"<p>I had a working webserver running LEMP (Linux, Nginx, Mysql, PHP) and I saw my Linode Linux VPS had a release upgrade. So I ran the Ubuntu &#8220;do-release-upgrade&#8221; command and after 15 minutes of updating it was updated, hooray!<\/p>\n\n\n\n<p>Except after rebooting, all my websites were dead with a 502 Nginx error. <\/p>\n\n\n\n<p>Upgrading from Ubuntu 20 to Ubuntu 21.10 the Ubuntu gods forced the upgrade from PHP7.4 to PHP8.0.<\/p>\n\n\n\n<p>I tried getting a phpinfo page to test if the php was processing, but instead nginx was just serving the php page like a download. So I knew it was a problem with the php being processed, Nginx has individual sites running through the sites-available and sites-enabled folder. I updated the sites-available files with the new php8.0 socket, assuming since they were already linked in sites-enabled then they should all work after the nginx service was restarted. However they still didn&#8217;t work, and after opening the linked files in the sites-enabled folder I realized those were just copied by the &#8220;sudo ln -s&#8221; command. So now for all my websites I need to change php7.4 socket to php8.0, delete all the sites-enabled links, then relink all the sites-available files. Doing this more than 2 times if pretty tedious. So naturally I wrote a script does all this, and for each of the sites in the sites-available folder it updates all of them and relinks them.<\/p>\n\n\n\n<p>I&#8217;m working on cleaning up this script and releasing it to help others, might try releasing it on my github<\/p>\n\n\n\n<p>Did you know only 1% of the internet is on php8? <a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/haydenjames.io\/78-of-the-web-powered-by-php-1-on-php-8\/\">https:\/\/haydenjames.io\/78-of-the-web-powered-by-php-1-on-php-8\/<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>I had a working webserver running LEMP (Linux, Nginx, Mysql, PHP) and I saw my Linode Linux VPS had a release upgrade. So I ran the Ubuntu &#8220;do-release-upgrade&#8221; command and after 15 minutes of updating it was updated, hooray! Except after rebooting, all my websites were dead with a 502 Nginx error. Upgrading from Ubuntu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9,3,5],"tags":[13,10,23,24],"class_list":["post-279","post","type-post","status-publish","format-standard","hentry","category-computers","category-linux","category-technology","category-websites","tag-computers","tag-linux","tag-software","tag-ubuntu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10 - Wyatt Sanders<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10 - Wyatt Sanders\" \/>\n<meta property=\"og:description\" content=\"I had a working webserver running LEMP (Linux, Nginx, Mysql, PHP) and I saw my Linode Linux VPS had a release upgrade. So I ran the Ubuntu &#8220;do-release-upgrade&#8221; command and after 15 minutes of updating it was updated, hooray! Except after rebooting, all my websites were dead with a 502 Nginx error. Upgrading from Ubuntu [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/\" \/>\n<meta property=\"og:site_name\" content=\"Wyatt Sanders\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-20T04:47:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-26T05:56:52+00:00\" \/>\n<meta name=\"author\" content=\"Wyatt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Wyatt\" \/>\n<meta name=\"twitter:site\" content=\"@Wyatt\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wyatt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/\"},\"author\":{\"name\":\"Wyatt\",\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/#\\\/schema\\\/person\\\/16cba5ffad1fd679b6af2f39ebb8cba3\"},\"headline\":\"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10\",\"datePublished\":\"2021-10-20T04:47:38+00:00\",\"dateModified\":\"2021-10-26T05:56:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/\"},\"wordCount\":280,\"publisher\":{\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/#\\\/schema\\\/person\\\/16cba5ffad1fd679b6af2f39ebb8cba3\"},\"keywords\":[\"computers\",\"linux\",\"software\",\"Ubuntu\"],\"articleSection\":[\"Computers\",\"Linux\",\"Technology\",\"Websites\"],\"inLanguage\":\"es\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/\",\"url\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/\",\"name\":\"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10 - Wyatt Sanders\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/#website\"},\"datePublished\":\"2021-10-20T04:47:38+00:00\",\"dateModified\":\"2021-10-26T05:56:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/#website\",\"url\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/\",\"name\":\"Wyatt Sanders\",\"description\":\"Jacksonville Engineer\",\"publisher\":{\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/#\\\/schema\\\/person\\\/16cba5ffad1fd679b6af2f39ebb8cba3\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/darkslategray-bear-162723.hostingersite.com\\\/#\\\/schema\\\/person\\\/16cba5ffad1fd679b6af2f39ebb8cba3\",\"name\":\"Wyatt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/wyattsanders.com\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/FB_IMG_1527477153419.jpg\",\"url\":\"https:\\\/\\\/wyattsanders.com\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/FB_IMG_1527477153419.jpg\",\"contentUrl\":\"https:\\\/\\\/wyattsanders.com\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/FB_IMG_1527477153419.jpg\",\"width\":1080,\"height\":1080,\"caption\":\"Wyatt\"},\"logo\":{\"@id\":\"https:\\\/\\\/wyattsanders.com\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/FB_IMG_1527477153419.jpg\"},\"sameAs\":[\"https:\\\/\\\/wyattsanders.com\",\"https:\\\/\\\/x.com\\\/Wyatt\"],\"url\":\"https:\\\/\\\/wyattsanders.com\\\/es\\\/author\\\/wyatt\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10 - Wyatt Sanders","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/","og_locale":"es_MX","og_type":"article","og_title":"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10 - Wyatt Sanders","og_description":"I had a working webserver running LEMP (Linux, Nginx, Mysql, PHP) and I saw my Linode Linux VPS had a release upgrade. So I ran the Ubuntu &#8220;do-release-upgrade&#8221; command and after 15 minutes of updating it was updated, hooray! Except after rebooting, all my websites were dead with a 502 Nginx error. Upgrading from Ubuntu [&hellip;]","og_url":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/","og_site_name":"Wyatt Sanders","article_published_time":"2021-10-20T04:47:38+00:00","article_modified_time":"2021-10-26T05:56:52+00:00","author":"Wyatt","twitter_card":"summary_large_image","twitter_creator":"@Wyatt","twitter_site":"@Wyatt","twitter_misc":{"Escrito por":"Wyatt","Tiempo de lectura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/#article","isPartOf":{"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/"},"author":{"name":"Wyatt","@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/#\/schema\/person\/16cba5ffad1fd679b6af2f39ebb8cba3"},"headline":"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10","datePublished":"2021-10-20T04:47:38+00:00","dateModified":"2021-10-26T05:56:52+00:00","mainEntityOfPage":{"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/"},"wordCount":280,"publisher":{"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/#\/schema\/person\/16cba5ffad1fd679b6af2f39ebb8cba3"},"keywords":["computers","linux","software","Ubuntu"],"articleSection":["Computers","Linux","Technology","Websites"],"inLanguage":"es"},{"@type":"WebPage","@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/","url":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/","name":"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10 - Wyatt Sanders","isPartOf":{"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/#website"},"datePublished":"2021-10-20T04:47:38+00:00","dateModified":"2021-10-26T05:56:52+00:00","breadcrumb":{"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/i-wrote-a-script-that-fixes-all-your-nginx-sites-to-php8-on-ubuntu-21-10\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/darkslategray-bear-162723.hostingersite.com\/"},{"@type":"ListItem","position":2,"name":"I wrote a script that fixes all your Nginx sites to php8 on Ubuntu 21.10"}]},{"@type":"WebSite","@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/#website","url":"https:\/\/darkslategray-bear-162723.hostingersite.com\/","name":"Wyatt Sanders","description":"Jacksonville Engineer","publisher":{"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/#\/schema\/person\/16cba5ffad1fd679b6af2f39ebb8cba3"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/darkslategray-bear-162723.hostingersite.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":["Person","Organization"],"@id":"https:\/\/darkslategray-bear-162723.hostingersite.com\/#\/schema\/person\/16cba5ffad1fd679b6af2f39ebb8cba3","name":"Wyatt","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/wyattsanders.com\/wp-content\/uploads\/2021\/10\/FB_IMG_1527477153419.jpg","url":"https:\/\/wyattsanders.com\/wp-content\/uploads\/2021\/10\/FB_IMG_1527477153419.jpg","contentUrl":"https:\/\/wyattsanders.com\/wp-content\/uploads\/2021\/10\/FB_IMG_1527477153419.jpg","width":1080,"height":1080,"caption":"Wyatt"},"logo":{"@id":"https:\/\/wyattsanders.com\/wp-content\/uploads\/2021\/10\/FB_IMG_1527477153419.jpg"},"sameAs":["https:\/\/wyattsanders.com","https:\/\/x.com\/Wyatt"],"url":"https:\/\/wyattsanders.com\/es\/author\/wyatt\/"}]}},"_links":{"self":[{"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/posts\/279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/comments?post=279"}],"version-history":[{"count":3,"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/posts\/279\/revisions"}],"predecessor-version":[{"id":382,"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/posts\/279\/revisions\/382"}],"wp:attachment":[{"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/media?parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/categories?post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wyattsanders.com\/es\/wp-json\/wp\/v2\/tags?post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}