{"id":4052,"date":"2026-01-03T14:00:27","date_gmt":"2026-01-03T11:00:27","guid":{"rendered":"https:\/\/www.dchost.com\/blog\/php-8-upgrade-guide-on-shared-hosting-and-vps-for-wordpress-and-laravel\/"},"modified":"2026-01-03T14:00:27","modified_gmt":"2026-01-03T11:00:27","slug":"php-8-upgrade-guide-on-shared-hosting-and-vps-for-wordpress-and-laravel","status":"publish","type":"post","link":"https:\/\/www.dchost.com\/blog\/en\/php-8-upgrade-guide-on-shared-hosting-and-vps-for-wordpress-and-laravel\/","title":{"rendered":"PHP 8 Upgrade Guide on Shared Hosting and VPS for WordPress and Laravel"},"content":{"rendered":"<div class=\"dchost-blog-content-wrapper\"><p>PHP 8 is now the standard for modern WordPress and Laravel projects. It brings real performance gains, stronger typing, and new language features, while older PHP 7.x branches are reaching end of life. That means less security support, more vulnerability risk, and increasing compatibility issues with new plugins and packages. The challenge is simple to describe but tricky to execute: how do you upgrade to PHP 8 on shared hosting or a <a href=\"https:\/\/www.dchost.com\/vps\">VPS<\/a> without breaking your sites, losing SEO, or dealing with hours of downtime?<\/p>\n<p>In this guide, we walk through a practical, hosting-side plan for upgrading to PHP 8 safely. We will focus on real-world WordPress and Laravel setups, from small blogs on shared hosting to multi-project stacks on a VPS. You will see how to prepare backups, create a staging environment, test code, switch PHP versions per site, and roll back cleanly if anything misbehaves. As the dchost.com team, we see these upgrades every day, so the steps below are based on what actually works in production, not just theory.<\/p>\n<div id=\"toc_container\" class=\"toc_transparent no_bullets\"><p class=\"toc_title\">\u0130&ccedil;indekiler<\/p><ul class=\"toc_list\"><li><a href=\"#Why_PHP_8_Matters_for_WordPress_and_Laravel_Sites\"><span class=\"toc_number toc_depth_1\">1<\/span> Why PHP 8 Matters for WordPress and Laravel Sites<\/a><ul><li><a href=\"#Performance_Security_and_Support_Lifecycles\"><span class=\"toc_number toc_depth_2\">1.1<\/span> Performance, Security and Support Lifecycles<\/a><\/li><\/ul><\/li><li><a href=\"#PreUpgrade_Checklist_What_to_Do_Before_Touching_PHP\"><span class=\"toc_number toc_depth_1\">2<\/span> Pre\u2011Upgrade Checklist: What to Do Before Touching PHP<\/a><ul><li><a href=\"#1_Inventory_Every_Site_and_Application\"><span class=\"toc_number toc_depth_2\">2.1<\/span> 1. Inventory Every Site and Application<\/a><\/li><li><a href=\"#2_Check_Application_Compatibility_with_PHP_8\"><span class=\"toc_number toc_depth_2\">2.2<\/span> 2. Check Application Compatibility with PHP 8<\/a><\/li><li><a href=\"#3_Take_Full_Verifiable_Backups\"><span class=\"toc_number toc_depth_2\">2.3<\/span> 3. Take Full, Verifiable Backups<\/a><\/li><li><a href=\"#4_Plan_a_Maintenance_Window_and_Communication\"><span class=\"toc_number toc_depth_2\">2.4<\/span> 4. Plan a Maintenance Window and Communication<\/a><\/li><\/ul><\/li><li><a href=\"#Setting_Up_a_Safe_Staging_Environment\"><span class=\"toc_number toc_depth_1\">3<\/span> Setting Up a Safe Staging Environment<\/a><ul><li><a href=\"#Staging_for_WordPress_on_Shared_Hosting\"><span class=\"toc_number toc_depth_2\">3.1<\/span> Staging for WordPress on Shared Hosting<\/a><\/li><li><a href=\"#Staging_for_Laravel_on_a_VPS_or_Shared_Hosting\"><span class=\"toc_number toc_depth_2\">3.2<\/span> Staging for Laravel on a VPS or Shared Hosting<\/a><\/li><li><a href=\"#What_to_Test_on_Staging_Under_PHP_8\"><span class=\"toc_number toc_depth_2\">3.3<\/span> What to Test on Staging Under PHP 8<\/a><\/li><\/ul><\/li><li><a href=\"#Upgrading_to_PHP_8_on_Shared_Hosting\"><span class=\"toc_number toc_depth_1\">4<\/span> Upgrading to PHP 8 on Shared Hosting<\/a><ul><li><a href=\"#Understanding_PerSite_PHP_Version_Control\"><span class=\"toc_number toc_depth_2\">4.1<\/span> Understanding Per\u2011Site PHP Version Control<\/a><\/li><li><a href=\"#StepbyStep_Switching_a_WordPress_Site_to_PHP_8\"><span class=\"toc_number toc_depth_2\">4.2<\/span> Step\u2011by\u2011Step: Switching a WordPress Site to PHP 8<\/a><\/li><li><a href=\"#StepbyStep_Switching_a_Laravel_App_to_PHP_8_on_Shared_Hosting\"><span class=\"toc_number toc_depth_2\">4.3<\/span> Step\u2011by\u2011Step: Switching a Laravel App to PHP 8 on Shared Hosting<\/a><\/li><\/ul><\/li><li><a href=\"#Upgrading_to_PHP_8_on_a_VPS\"><span class=\"toc_number toc_depth_1\">5<\/span> Upgrading to PHP 8 on a VPS<\/a><ul><li><a href=\"#Install_the_New_PHP_8_Packages\"><span class=\"toc_number toc_depth_2\">5.1<\/span> Install the New PHP 8 Packages<\/a><\/li><li><a href=\"#Configure_PHPFPM_Pools_Per_Site_or_App\"><span class=\"toc_number toc_depth_2\">5.2<\/span> Configure PHP\u2011FPM Pools Per Site or App<\/a><\/li><li><a href=\"#Point_Your_Web_Server_to_PHP_8\"><span class=\"toc_number toc_depth_2\">5.3<\/span> Point Your Web Server to PHP 8<\/a><\/li><li><a href=\"#Align_CLI_PHP_for_Artisan_WPCLI_and_Cron\"><span class=\"toc_number toc_depth_2\">5.4<\/span> Align CLI PHP for Artisan, WP\u2011CLI and Cron<\/a><\/li><li><a href=\"#Tune_OPcache_and_Performance_Under_PHP_8\"><span class=\"toc_number toc_depth_2\">5.5<\/span> Tune OPcache and Performance Under PHP 8<\/a><\/li><\/ul><\/li><li><a href=\"#WordPressSpecific_PHP_8_Gotchas_and_Fixes\"><span class=\"toc_number toc_depth_1\">6<\/span> WordPress\u2011Specific PHP 8 Gotchas and Fixes<\/a><ul><li><a href=\"#Keep_Core_Themes_and_Plugins_Modern\"><span class=\"toc_number toc_depth_2\">6.1<\/span> Keep Core, Themes and Plugins Modern<\/a><\/li><li><a href=\"#Typical_PHP_8_Errors_in_WordPress\"><span class=\"toc_number toc_depth_2\">6.2<\/span> Typical PHP 8 Errors in WordPress<\/a><\/li><li><a href=\"#Multisite_WooCommerce_and_Heavy_Sites\"><span class=\"toc_number toc_depth_2\">6.3<\/span> Multisite, WooCommerce and Heavy Sites<\/a><\/li><\/ul><\/li><li><a href=\"#LaravelSpecific_PHP_8_Gotchas_and_Fixes\"><span class=\"toc_number toc_depth_1\">7<\/span> Laravel\u2011Specific PHP 8 Gotchas and Fixes<\/a><ul><li><a href=\"#Match_Laravel_Version_to_PHP_Version\"><span class=\"toc_number toc_depth_2\">7.1<\/span> Match Laravel Version to PHP Version<\/a><\/li><li><a href=\"#ThirdParty_Packages_and_PHP_8\"><span class=\"toc_number toc_depth_2\">7.2<\/span> Third\u2011Party Packages and PHP 8<\/a><\/li><li><a href=\"#Queues_Schedulers_and_Octane\"><span class=\"toc_number toc_depth_2\">7.3<\/span> Queues, Schedulers and Octane<\/a><\/li><\/ul><\/li><li><a href=\"#Rollback_and_ZeroDowntime_Strategies\"><span class=\"toc_number toc_depth_1\">8<\/span> Rollback and Zero\u2011Downtime Strategies<\/a><ul><li><a href=\"#Instant_Rollback_on_Shared_Hosting\"><span class=\"toc_number toc_depth_2\">8.1<\/span> Instant Rollback on Shared Hosting<\/a><\/li><li><a href=\"#BlueGreen_Style_Releases_on_a_VPS\"><span class=\"toc_number toc_depth_2\">8.2<\/span> Blue\u2011Green Style Releases on a VPS<\/a><\/li><li><a href=\"#Combining_PHP_Upgrades_with_Planned_Maintenance\"><span class=\"toc_number toc_depth_2\">8.3<\/span> Combining PHP Upgrades with Planned Maintenance<\/a><\/li><\/ul><\/li><li><a href=\"#When_Shared_Hosting_Is_Not_Enough_Moving_to_a_VPS\"><span class=\"toc_number toc_depth_1\">9<\/span> When Shared Hosting Is Not Enough: Moving to a VPS<\/a><\/li><li><a href=\"#Putting_It_All_Together_A_Practical_PHP_8_Upgrade_Plan\"><span class=\"toc_number toc_depth_1\">10<\/span> Putting It All Together: A Practical PHP 8 Upgrade Plan<\/a><\/li><\/ul><\/div>\n<h2><span id=\"Why_PHP_8_Matters_for_WordPress_and_Laravel_Sites\">Why PHP 8 Matters for WordPress and Laravel Sites<\/span><\/h2>\n<h3><span id=\"Performance_Security_and_Support_Lifecycles\">Performance, Security and Support Lifecycles<\/span><\/h3>\n<p>Upgrading to PHP 8 is not just about new syntax like match expressions or attributes. For WordPress and Laravel workloads, you typically gain:<\/p>\n<ul>\n<li><strong>Better performance<\/strong>: PHP 8\u2019s JIT and engine improvements reduce CPU usage and response times, especially for complex Laravel applications or heavy WooCommerce stores.<\/li>\n<li><strong>Longer security support<\/strong>: PHP 7.4 and many earlier branches are out of active support. Staying on them means relying on your hosting environment to isolate and protect outdated runtimes, which is never ideal.<\/li>\n<li><strong>Future plugin and package compatibility<\/strong>: New WordPress plugins, themes, and Laravel packages increasingly assume PHP 8+ features and may drop older versions entirely.<\/li>\n<\/ul>\n<p>On the flip side, PHP 8 is stricter. It turns many previously silent issues into warnings or fatal errors (for example, passing null to non-nullable parameters, or using deprecated functions). That\u2019s why a structured upgrade process is essential.<\/p>\n<p>If you want a deeper, developer-focused checklist, we also recommend our detailed article <a href=\"https:\/\/www.dchost.com\/blog\/en\/php-8-x-yukseltme-kontrol-listesi-wordpress-ve-laravelde-geriye-uyumluluk-opcache-preload-ve-fpm-havuz-ayarlari-nasil-tatli-tatli-kurulur\/\">on the PHP 8.x upgrade checklist, backwards compatibility and FPM tuning for WordPress and Laravel<\/a>.<\/p>\n<h2><span id=\"PreUpgrade_Checklist_What_to_Do_Before_Touching_PHP\">Pre\u2011Upgrade Checklist: What to Do Before Touching PHP<\/span><\/h2>\n<h3><span id=\"1_Inventory_Every_Site_and_Application\">1. Inventory Every Site and Application<\/span><\/h3>\n<p>Start by listing everything that depends on PHP on your hosting account or VPS:<\/p>\n<ul>\n<li>All <strong>WordPress sites<\/strong> (including multisite networks)<\/li>\n<li>All <strong>Laravel applications<\/strong> (and which versions they run)<\/li>\n<li>Other PHP apps: old CMSes, custom panels, legacy tools<\/li>\n<li>CLI jobs, cron tasks and queue workers that call <code>php<\/code><\/li>\n<\/ul>\n<p>This matters because you can (and should) upgrade sites <strong>one by one<\/strong>, especially on shared hosting where multiple domains share the same account. On a VPS, you can also run multiple PHP versions side by side and migrate vhosts gradually.<\/p>\n<h3><span id=\"2_Check_Application_Compatibility_with_PHP_8\">2. Check Application Compatibility with PHP 8<\/span><\/h3>\n<p>Next, check what PHP versions your applications officially support.<\/p>\n<ul>\n<li><strong>WordPress core<\/strong>: modern versions support PHP 8+, but many older themes\/plugins do not. Aim for at least WordPress 6.x before the PHP 8 transition.<\/li>\n<li><strong>Laravel<\/strong>:\n<ul>\n<li>Laravel 8 supports PHP 7.3\u20138.1 (depending on minor version)<\/li>\n<li>Laravel 9 requires PHP 8.0+<\/li>\n<li>Laravel 10 requires PHP 8.1+<\/li>\n<\/ul>\n<\/li>\n<li><strong>Composer dependencies<\/strong>: check <code>composer.json<\/code> for the <code>php<\/code> constraint and packages that require PHP 8+.<\/li>\n<\/ul>\n<p>On shared hosting, you usually have a PHP selector in cPanel\/DirectAdmin\/Plesk. On a VPS, run:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">php -v\n<\/code><\/pre>\n<p>to see your current PHP version, and make sure your OS repositories or packages can deliver the PHP 8 branch you need.<\/p>\n<h3><span id=\"3_Take_Full_Verifiable_Backups\">3. Take Full, Verifiable Backups<\/span><\/h3>\n<p>Before any major version change, you must be able to get back to a known-good state quickly.<\/p>\n<ul>\n<li><strong>Files<\/strong>: public web roots, <code>wp-content<\/code>, Laravel <code>app\/<\/code>, <code>config\/<\/code>, <code>storage\/<\/code>, and any custom code outside those.<\/li>\n<li><strong>Databases<\/strong>: <code>mysqldump<\/code> or panel backups for each site\u2019s database.<\/li>\n<li><strong>Configs<\/strong>: <code>.env<\/code> files for Laravel, WordPress <code>wp-config.php<\/code>, web server vhost configs, cron job definitions.<\/li>\n<\/ul>\n<p>Do at least one test restore to confirm your backup process actually works. For WordPress-focused setups, our guide on <a href=\"https:\/\/www.dchost.com\/blog\/en\/wordpress-yedekleme-stratejileri-paylasimli-hosting-ve-vpste-otomatik-yedek-ve-geri-yukleme\/\">WordPress backup strategies on shared hosting and VPS<\/a> walks through practical scheduling and restore testing.<\/p>\n<p>At dchost.com we follow the 3\u20112\u20111 principle (three copies, two media types, one off\u2011site) for critical environments; you do not need to be that strict for a small blog, but you should always have at least one off\u2011server backup.<\/p>\n<h3><span id=\"4_Plan_a_Maintenance_Window_and_Communication\">4. Plan a Maintenance Window and Communication<\/span><\/h3>\n<p>Even when you aim for zero downtime, it is wise to schedule a realistic maintenance window:<\/p>\n<ul>\n<li>Pick low\u2011traffic hours based on your analytics.<\/li>\n<li>Announce a short maintenance window on your site or via email.<\/li>\n<li>Prepare a simple, branded maintenance page if needed.<\/li>\n<\/ul>\n<p>If you care about SEO and want to avoid negative signals during short outages, see our article on <a href=\"https:\/\/www.dchost.com\/blog\/en\/bakim-modu-ve-planli-kesinti-yonetimi-seo-kaybi-yasamadan-maintenance-page-yayinlama-rehberi\/\">maintenance windows and downtime pages without hurting SEO<\/a>. It explains how to use correct HTTP status codes and temporary pages safely.<\/p>\n<h2><span id=\"Setting_Up_a_Safe_Staging_Environment\">Setting Up a Safe Staging Environment<\/span><\/h2>\n<h3><span id=\"Staging_for_WordPress_on_Shared_Hosting\">Staging for WordPress on Shared Hosting<\/span><\/h3>\n<p>The cleanest way to test PHP 8 is to clone your site to a staging environment and switch PHP there first. On shared hosting, you have two common options:<\/p>\n<ul>\n<li><strong>Subdomain staging<\/strong>: <code>staging.example.com<\/code> with a full copy of files and database.<\/li>\n<li><strong>Subdirectory staging<\/strong>: <code>example.com\/staging<\/code> if subdomains are not convenient.<\/li>\n<\/ul>\n<p>cPanel and some installers can clone WordPress automatically; alternatively, you can copy files via File Manager\/SFTP and export\/import the database. Then update the site URL in <code>wp_options<\/code> and in <code>wp-config.php<\/code> if needed.<\/p>\n<p>We have a step\u2011by\u2011step walkthrough in our dedicated guide <a href=\"https:\/\/www.dchost.com\/blog\/en\/paylasimli-hostingde-wordpress-staging-ortami-kurmak-adim-adim-uygulamali-rehber\/\">on setting up WordPress staging on shared hosting with subdomains and clones<\/a>.<\/p>\n<h3><span id=\"Staging_for_Laravel_on_a_VPS_or_Shared_Hosting\">Staging for Laravel on a VPS or Shared Hosting<\/span><\/h3>\n<p>For Laravel, staging is usually a separate virtual host and .env:<\/p>\n<ul>\n<li>On <strong>shared hosting<\/strong>, create a new subdomain or addon domain pointing to a copy of your Laravel project, with its own database and <code>.env<\/code> file.<\/li>\n<li>On a <strong>VPS<\/strong>, add a new vhost (Nginx\/Apache) pointing to a cloned code directory, typically a different Git branch or a deployed copy.<\/li>\n<\/ul>\n<p>Use a separate database and queue connection to avoid mixing staging and production data. In <code>.env<\/code>, change <code>APP_URL<\/code>, database credentials, cache, and session prefixes to keep them isolated.<\/p>\n<h3><span id=\"What_to_Test_on_Staging_Under_PHP_8\">What to Test on Staging Under PHP 8<\/span><\/h3>\n<p>Once your staging environment is live, switch it to PHP 8 (we will show how in the next sections) and test thoroughly:<\/p>\n<ul>\n<li>Key user journeys: login, registration, contact forms, checkout, search.<\/li>\n<li>Admin tasks: publishing posts\/products, editing menus, uploading media.<\/li>\n<li>Background tasks: scheduled posts, cron jobs, Laravel queues and scheduled commands.<\/li>\n<li>Logs: check <code>error_log<\/code> or storage logs for PHP warnings, deprecated notices and fatal errors.<\/li>\n<\/ul>\n<p>Fixing issues on staging first dramatically reduces stress when you upgrade production.<\/p>\n<h2><span id=\"Upgrading_to_PHP_8_on_Shared_Hosting\">Upgrading to PHP 8 on Shared Hosting<\/span><\/h2>\n<h3><span id=\"Understanding_PerSite_PHP_Version_Control\">Understanding Per\u2011Site PHP Version Control<\/span><\/h3>\n<p>Most modern shared hosting platforms (including our shared hosting at dchost.com) allow you to select PHP versions per domain or even per directory. In cPanel, this is usually called \u201cMultiPHP Manager\u201d or \u201cSelect PHP Version\u201d; in DirectAdmin, you may see \u201cPHP Version Selector\u201d.<\/p>\n<p>If you are not yet familiar with this feature, our article on <a href=\"https:\/\/www.dchost.com\/blog\/en\/cpanel-ve-directadminde-coklu-php-surumu-yonetimi-her-site-icin-dogru-php-7-x-8-x-secimi\/\">managing multiple PHP versions on cPanel and DirectAdmin per site<\/a> explains the UI and common scenarios.<\/p>\n<h3><span id=\"StepbyStep_Switching_a_WordPress_Site_to_PHP_8\">Step\u2011by\u2011Step: Switching a WordPress Site to PHP 8<\/span><\/h3>\n<ol>\n<li><strong>Upgrade WordPress core, themes and plugins<\/strong> to the latest stable versions while still on your current PHP version. Many compatibility fixes are delivered via normal plugin updates.<\/li>\n<li><strong>Enable debugging logs<\/strong> (not display) in <code>wp-config.php<\/code>:\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">define( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );\ndefine( 'WP_DEBUG_DISPLAY', false );\n<\/code><\/pre>\n<\/li>\n<li><strong>Open your control panel<\/strong> and go to the PHP Selector \/ MultiPHP Manager.\n<ul>\n<li>Select only the <strong>staging<\/strong> domain first and change its PHP version to 8.0, 8.1 or 8.2 depending on your plan.<\/li>\n<li>Apply the change and wait a few seconds.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Test staging thoroughly<\/strong> as described earlier. Check <code>wp-content\/debug.log<\/code> and <code>error_log<\/code> for issues.<\/li>\n<li>When staging is clean, <strong>repeat the version change for the production domain<\/strong> and retest the most critical flows (home page, login, checkout, contact forms).<\/li>\n<li>If anything fails, <strong>switch the PHP version back<\/strong> in the same panel and use your backups\/logs to diagnose.<\/li>\n<\/ol>\n<p>On shared hosting, rollbacks are usually as simple as selecting the old PHP version again, which is why we recommend this path if you are upgrading a smaller site with limited custom code.<\/p>\n<h3><span id=\"StepbyStep_Switching_a_Laravel_App_to_PHP_8_on_Shared_Hosting\">Step\u2011by\u2011Step: Switching a Laravel App to PHP 8 on Shared Hosting<\/span><\/h3>\n<p>Laravel on shared hosting is less common but absolutely doable if your provider exposes PHP 8 via both web and CLI.<\/p>\n<ol>\n<li><strong>Check Laravel version<\/strong> (see <code>composer.json<\/code> or run <code>php artisan --version<\/code>) and verify it supports the PHP 8 version you want.<\/li>\n<li><strong>Update Composer dependencies<\/strong> on a local or staging environment:\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">composer update\n<\/code><\/pre>\n<p>    Ensure your <code>composer.json<\/code> has an appropriate constraint like:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">&quot;php&quot;: &quot;^8.0&quot;<\/code><\/pre>\n<\/li>\n<li><strong>Switch the domain\/subdomain to PHP 8<\/strong> in the panel, just as for WordPress.<\/li>\n<li><strong>Check the CLI PHP version<\/strong> used by cron jobs:\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">php -v\n<\/code><\/pre>\n<p>    If your host has multiple binaries (e.g., <code>\/opt\/php81\/bin\/php<\/code>), update cron commands and queue worker commands to use the PHP 8 binary.\n  <\/li>\n<li><strong>Run key commands<\/strong> on staging: <code>php artisan config:cache<\/code>, <code>php artisan route:cache<\/code>, <code>php artisan queue:work<\/code> and verify no compatibility errors appear.<\/li>\n<\/ol>\n<p>If you cannot control which PHP version cron uses, contact our support or your provider\u2019s support; on dchost.com we can help align web and CLI PHP versions so your Laravel schedulers and queues run under the correct runtime.<\/p>\n<h2><span id=\"Upgrading_to_PHP_8_on_a_VPS\">Upgrading to PHP 8 on a VPS<\/span><\/h2>\n<h3><span id=\"Install_the_New_PHP_8_Packages\">Install the New PHP 8 Packages<\/span><\/h3>\n<p>On a VPS, you are responsible for installing PHP 8 yourself (unless you are on a managed stack). The exact commands depend on your Linux distribution; for example:<\/p>\n<ul>\n<li><strong>Debian\/Ubuntu<\/strong> (with appropriate repositories):\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">sudo apt update\nsudo apt install php8.2 php8.2-fpm php8.2-cli php8.2-mysql php8.2-xml php8.2-mbstring php8.2-curl php8.2-zip\n<\/code><\/pre>\n<\/li>\n<li><strong>AlmaLinux\/Rocky Linux\/CentOS<\/strong> (with Remi or AppStream):\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">sudo dnf module reset php\nsudo dnf module enable php:8.2\nsudo dnf install php php-fpm php-mysqlnd php-xml php-mbstring php-curl php-zip\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>We strongly recommend running PHP\u2011FPM rather than mod_php on modern stacks; it is more efficient and works better with multiple PHP versions.<\/p>\n<h3><span id=\"Configure_PHPFPM_Pools_Per_Site_or_App\">Configure PHP\u2011FPM Pools Per Site or App<\/span><\/h3>\n<p>With PHP 8 installed, configure <strong>separate FPM pools<\/strong> for each major site or group of sites. This gives you isolation: a fatal error in one app cannot easily crash others, and you can tune settings per pool (memory, max children, etc.).<\/p>\n<p>Our article <a href=\"https:\/\/www.dchost.com\/blog\/en\/ofiste-bir-sabah-php-yukseltmesi-ter-damlalari-ve-kucuk-bir-aydinlanma\/\">on running multiple PHP\u2011FPM pools per site without drama<\/a> walks through a real\u2011world configuration strategy on Nginx.<\/p>\n<p>Basic steps:<\/p>\n<ol>\n<li>Create a new pool file like <code>\/etc\/php\/8.2\/fpm\/pool.d\/example.conf<\/code>.<\/li>\n<li>Set a unique <code>listen<\/code> socket (e.g., <code>\/run\/php-fpm-example.sock<\/code>), <code>user<\/code>, <code>group<\/code> and reasonable limits (pm, pm.max_children, etc.).<\/li>\n<li>Restart PHP\u2011FPM: <code>sudo systemctl restart php8.2-fpm<\/code>.<\/li>\n<\/ol>\n<h3><span id=\"Point_Your_Web_Server_to_PHP_8\">Point Your Web Server to PHP 8<\/span><\/h3>\n<p>Update your Nginx or Apache configuration for the specific site you are upgrading:<\/p>\n<ul>\n<li><strong>Nginx FastCGI example<\/strong>:\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">fastcgi_pass unix:\/run\/php-fpm-example.sock;\n<\/code><\/pre>\n<\/li>\n<li><strong>Apache with ProxyPassMatch (FPM via proxy_fcgi)<\/strong>:\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">ProxyPassMatch ^\/(.*) fcgi:\/\/127.0.0.1:9000\/var\/www\/example.com\/public\/$1\n<\/code><\/pre>\n<p>    (Adjust to your socket\/port and document root.)\n  <\/li>\n<\/ul>\n<p>Reload the web server (not just restart):<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">sudo systemctl reload nginx\n# or\nsudo systemctl reload apache2\n<\/code><\/pre>\n<p>Now only that specific site is running under PHP 8; others can continue on PHP 7.x until you are ready.<\/p>\n<h3><span id=\"Align_CLI_PHP_for_Artisan_WPCLI_and_Cron\">Align CLI PHP for Artisan, WP\u2011CLI and Cron<\/span><\/h3>\n<p>For Laravel, the PHP version used by <code>artisan<\/code>, queue workers and scheduled tasks must match your web PHP as closely as possible. On many systems, you can update <code>\/usr\/bin\/php<\/code> via <code>update-alternatives<\/code> (Debian\/Ubuntu) or adjust paths in cron:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">crontab -e\n# Example:\n* * * * * \/usr\/bin\/php8.2 \/var\/www\/app\/artisan schedule:run &gt;&gt; \/dev\/null 2&gt;&amp;1\n<\/code><\/pre>\n<p>Similarly, ensure queue workers (systemd units or Supervisor programs) call the PHP 8 binary.<\/p>\n<h3><span id=\"Tune_OPcache_and_Performance_Under_PHP_8\">Tune OPcache and Performance Under PHP 8<\/span><\/h3>\n<p>While you are upgrading, it is a good opportunity to review OPcache settings, which greatly affect WordPress and Laravel performance under PHP 8. Key directives include:<\/p>\n<ul>\n<li><code>opcache.enable=1<\/code><\/li>\n<li><code>opcache.memory_consumption<\/code> (e.g., 128\u2013256MB for a busy app)<\/li>\n<li><code>opcache.max_accelerated_files<\/code> (increase for large codebases)<\/li>\n<li><code>opcache.validate_timestamps<\/code> and <code>revalidate_freq<\/code> for deployment behaviour<\/li>\n<\/ul>\n<p>For a deeper dive with hosting\u2011side examples, see our article <a href=\"https:\/\/www.dchost.com\/blog\/en\/php-opcache-ayarlari-wordpress-laravel-ve-woocommerce-icin-en-iyi-konfigurasyon-rehberi\/\">on PHP OPcache settings for WordPress, Laravel and WooCommerce<\/a>.<\/p>\n<h2><span id=\"WordPressSpecific_PHP_8_Gotchas_and_Fixes\">WordPress\u2011Specific PHP 8 Gotchas and Fixes<\/span><\/h2>\n<h3><span id=\"Keep_Core_Themes_and_Plugins_Modern\">Keep Core, Themes and Plugins Modern<\/span><\/h3>\n<p>Most serious PHP 8 issues in WordPress come from old themes and plugins. Before upgrading:<\/p>\n<ul>\n<li>Remove completely unused or abandoned plugins.<\/li>\n<li>Replace outdated themes with maintained ones where possible.<\/li>\n<li>Update everything to the latest version before touching PHP.<\/li>\n<\/ul>\n<p>On staging, enable debug logging and scrutinize warnings like \u201cDeprecated\u201d or \u201cTrying to access array offset on value of type null\u201d. Some are just noise; others reveal logic bugs that may become fatal in future PHP versions.<\/p>\n<h3><span id=\"Typical_PHP_8_Errors_in_WordPress\">Typical PHP 8 Errors in WordPress<\/span><\/h3>\n<p>Common patterns we see during upgrades include:<\/p>\n<ul>\n<li><strong>Type errors<\/strong>: plugins calling functions with wrong argument types (e.g., string vs array) now throw fatal <code>TypeError<\/code> exceptions.<\/li>\n<li><strong>Deprecated function calls<\/strong>: older code using removed functions (like <code>create_function<\/code>) or relying on magic quotes.<\/li>\n<li><strong>Deprecated dynamic properties<\/strong>: PHP 8.2 deprecates dynamic properties; some plugins will log many notices until updated.<\/li>\n<\/ul>\n<p>When you see these issues:<\/p>\n<ul>\n<li>Update the offending plugin\/theme if a newer version exists.<\/li>\n<li>Temporarily disable problematic plugins and retest.<\/li>\n<li>If a critical plugin is abandoned and incompatible, you may need to stay on an older PHP branch temporarily while you replace it.<\/li>\n<\/ul>\n<h3><span id=\"Multisite_WooCommerce_and_Heavy_Sites\">Multisite, WooCommerce and Heavy Sites<\/span><\/h3>\n<p>For multisite and WooCommerce stores, we strongly recommend staging and step\u2011by\u2011step upgrades. Consider:<\/p>\n<ul>\n<li>Testing payment gateways, shipping calculators and complex checkout flows under PHP 8.<\/li>\n<li>Monitoring resource usage (CPU, RAM) during peak traffic after the upgrade.<\/li>\n<li>Combining the PHP upgrade with caching and database tuning for maximum benefit.<\/li>\n<\/ul>\n<p>We have separate guides for WooCommerce performance, MySQL tuning and object caching in our blog, which pair nicely with a PHP 8 migration.<\/p>\n<h2><span id=\"LaravelSpecific_PHP_8_Gotchas_and_Fixes\">Laravel\u2011Specific PHP 8 Gotchas and Fixes<\/span><\/h2>\n<h3><span id=\"Match_Laravel_Version_to_PHP_Version\">Match Laravel Version to PHP Version<\/span><\/h3>\n<p>Before you even install PHP 8, check your Laravel version:<\/p>\n<ul>\n<li>If you run <strong>Laravel 5.x or 6.x<\/strong>, you will almost certainly need to upgrade Laravel first before switching to PHP 8.<\/li>\n<li>Laravel 7\/8 may support PHP 8.0 with certain minor releases; consult the official docs or your <code>composer.json<\/code>.<\/li>\n<li>Laravel 9 and 10 are built for PHP 8.x and are usually the best targets for new projects.<\/li>\n<\/ul>\n<p>Update your Composer constraints to allow PHP 8 and run a full <code>composer update<\/code> in a development environment before deploying.<\/p>\n<h3><span id=\"ThirdParty_Packages_and_PHP_8\">Third\u2011Party Packages and PHP 8<\/span><\/h3>\n<p>Even if Laravel core supports PHP 8, packages may lag behind. Pay special attention to:<\/p>\n<ul>\n<li>Payment gateways and SDKs<\/li>\n<li>PDF generators, Excel import\/export libraries<\/li>\n<li>Old admin panels or scaffolding packages<\/li>\n<\/ul>\n<p>On staging under PHP 8, run your test suite (if you have one) and check logs in <code>storage\/logs\/laravel.log<\/code> for type errors and deprecations.<\/p>\n<h3><span id=\"Queues_Schedulers_and_Octane\">Queues, Schedulers and Octane<\/span><\/h3>\n<p>Laravel\u2019s background workers are highly sensitive to PHP configuration:<\/p>\n<ul>\n<li>Ensure all <strong>queue workers<\/strong> run with PHP 8 (systemd units, Supervisor configs).<\/li>\n<li>Check your <strong>schedule:run<\/strong> cron entry uses the same binary.<\/li>\n<li>If you use <strong>Laravel Octane<\/strong>, verify support for your chosen PHP 8 version and Swoole\/RoadRunner versions.<\/li>\n<\/ul>\n<p>After the upgrade, monitor job failure counts and worker logs closely for the first few days.<\/p>\n<h2><span id=\"Rollback_and_ZeroDowntime_Strategies\">Rollback and Zero\u2011Downtime Strategies<\/span><\/h2>\n<h3><span id=\"Instant_Rollback_on_Shared_Hosting\">Instant Rollback on Shared Hosting<\/span><\/h3>\n<p>On shared hosting, rollback is usually a UI operation:<\/p>\n<ul>\n<li>Open your PHP version selector.<\/li>\n<li>Change the problem domain back to its previous PHP version.<\/li>\n<li>Clear any caches (WordPress caching plugins, opcode caches, CDN edge cache) and retest.<\/li>\n<\/ul>\n<p>Because you did not touch code or database schemas when changing only PHP versions, this is normally safe and fast. If errors persist, restore from your backups.<\/p>\n<h3><span id=\"BlueGreen_Style_Releases_on_a_VPS\">Blue\u2011Green Style Releases on a VPS<\/span><\/h3>\n<p>On a VPS, we recommend a simple blue\u2011green pattern for bigger Laravel and WordPress sites:<\/p>\n<ul>\n<li>Keep two application directories: <code>releases\/blue<\/code> and <code>releases\/green<\/code>.<\/li>\n<li>Point your web root symlink (e.g., <code>current<\/code>) to one of them.<\/li>\n<li>Deploy the new code and PHP version to the other directory, warm caches, run migrations.<\/li>\n<li>Switch the symlink and reload PHP\u2011FPM when ready.<\/li>\n<\/ul>\n<p>If anything fails under PHP 8, switch the symlink back. We explore these patterns in more depth in our articles about blue\u2011green deployments and zero\u2011downtime releases on VPS environments.<\/p>\n<h3><span id=\"Combining_PHP_Upgrades_with_Planned_Maintenance\">Combining PHP Upgrades with Planned Maintenance<\/span><\/h3>\n<p>For high\u2011traffic stores or critical applications, it is often best to treat the PHP upgrade like any other production change:<\/p>\n<ul>\n<li>Announce a maintenance window.<\/li>\n<li>Enable a friendly maintenance page or queue\u2011draining mode.<\/li>\n<li>Upgrade PHP, run sanity checks, then reopen traffic.<\/li>\n<\/ul>\n<p>The key is to have a documented runbook: step\u2011by\u2011step actions, checks, and a clear rollback path. We follow the same pattern internally at dchost.com when we upgrade shared hosting clusters and VPS templates.<\/p>\n<h2><span id=\"When_Shared_Hosting_Is_Not_Enough_Moving_to_a_VPS\">When Shared Hosting Is Not Enough: Moving to a VPS<\/span><\/h2>\n<p>PHP 8 itself will run happily on shared hosting, but some workloads outgrow this environment:<\/p>\n<ul>\n<li>Laravel applications with heavy queues, WebSockets, or API traffic.<\/li>\n<li>WooCommerce stores handling thousands of concurrent users.<\/li>\n<li>Multi\u2011tenant SaaS platforms with strict isolation and custom PHP modules.<\/li>\n<\/ul>\n<p>In those cases, a VPS gives you:<\/p>\n<ul>\n<li>Full control over PHP versions, extensions and FPM pools.<\/li>\n<li>Dedicated CPU\/RAM and disk I\/O.<\/li>\n<li>Freedom to run Redis, RabbitMQ, Elasticsearch and other services.<\/li>\n<\/ul>\n<p>If you are considering a move, our guide <a href=\"https:\/\/www.dchost.com\/blog\/en\/laravel-ve-diger-php-frameworkler-icin-paylasimli-hosting-mi-vps-mi\/\">comparing shared hosting vs VPS for Laravel and other PHP frameworks<\/a> explains when it makes sense to upgrade and how to size your VPS correctly.<\/p>\n<h2><span id=\"Putting_It_All_Together_A_Practical_PHP_8_Upgrade_Plan\">Putting It All Together: A Practical PHP 8 Upgrade Plan<\/span><\/h2>\n<p>To summarise the safest approach to upgrading WordPress and Laravel sites to PHP 8 on shared hosting or a VPS:<\/p>\n<ol>\n<li><strong>Prepare<\/strong>: inventory all PHP applications, confirm compatibility, and take full backups.<\/li>\n<li><strong>Build staging<\/strong>: clone your site or app to a staging subdomain or vhost and update it to the latest code and dependencies.<\/li>\n<li><strong>Upgrade staging to PHP 8<\/strong>: use the panel selector on shared hosting or configure a new PHP\u2011FPM pool on your VPS.<\/li>\n<li><strong>Test deeply<\/strong>: run through real user flows, check logs, fix deprecations and type errors.<\/li>\n<li><strong>Switch production during a planned window<\/strong>: change the PHP version for the live domain or update your VPS vhost, then verify quickly.<\/li>\n<li><strong>Monitor and be ready to roll back<\/strong>: keep your previous PHP version available for quick rollback if something unexpected appears.<\/li>\n<\/ol>\n<p>PHP 8 is a big step forward in performance and long\u2011term supportability for both WordPress and Laravel. With careful staging, predictable backups and a clear rollback path, the upgrade does not need to be stressful.<\/p>\n<p>At dchost.com, we design our shared hosting, VPS and <a href=\"https:\/\/www.dchost.com\/dedicated-server\">dedicated server<\/a>s to make multi\u2011PHP environments and controlled upgrades as smooth as possible. If you are planning a PHP 8 migration and want a hosting platform that supports per\u2011site PHP versions, proper staging environments and expert support, you are welcome to reach out to our team. We are happy to review your current setup, suggest an appropriate shared hosting, VPS or dedicated plan, and help you plan a calm, low\u2011risk upgrade path for your WordPress and Laravel projects.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>PHP 8 is now the standard for modern WordPress and Laravel projects. It brings real performance gains, stronger typing, and new language features, while older PHP 7.x branches are reaching end of life. That means less security support, more vulnerability risk, and increasing compatibility issues with new plugins and packages. The challenge is simple to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4053,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-4052","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-teknoloji"],"_links":{"self":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/4052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/comments?post=4052"}],"version-history":[{"count":0,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/4052\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media\/4053"}],"wp:attachment":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media?parent=4052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/categories?post=4052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/tags?post=4052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}