{"id":75,"date":"2025-08-07T21:07:32","date_gmt":"2025-08-07T19:07:32","guid":{"rendered":"https:\/\/www.patrickphang.nl\/?p=75"},"modified":"2025-08-11T21:57:30","modified_gmt":"2025-08-11T19:57:30","slug":"upgrading-php-from-8-2-to-8-3-on-raspberry-pi-a-hobbyists-command-line-adventure","status":"publish","type":"post","link":"https:\/\/www.patrickphang.nl\/index.php\/2025\/08\/07\/upgrading-php-from-8-2-to-8-3-on-raspberry-pi-a-hobbyists-command-line-adventure\/","title":{"rendered":"Upgrading PHP from 8.2 to 8.3 on Raspberry Pi: A Hobbyist&#8217;s Command Line Adventure"},"content":{"rendered":"\n<div class=\"wp-block-group alignfull has-base-color has-contrast-3-background-color has-text-color has-background has-link-color wp-elements-8f1be27cbe92cebd7e9a32034f83aeaa has-global-padding is-content-justification-center is-layout-constrained wp-container-core-group-is-layout-733701de wp-block-group-is-layout-constrained\" style=\"margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)\">\n<p>Running a website on a Raspberry Pi is both rewarding and educational, especially when you&#8217;re doing it as a hobby like I am. I&#8217;m not a professional developer or system administrator, just someone who enjoys tinkering with technology in my spare time. But that comes with its own set of challenges! One of those challenges? There&#8217;s no convenient &#8220;upgrade&#8221; button when you need to update your PHP version. Today, I&#8217;ll walk you through how I upgraded my Raspberry Pi web server from PHP 8.2 to PHP 8.3 using terminal commands.<\/p>\n\n\n\n<h2 id=\"why-upgrade-to-php-83\" class=\"wp-block-heading\">Why Upgrade to PHP 8.3?<\/h2>\n\n\n\n<p>PHP 8.3 brings several improvements including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Better performance optimizations<\/li>\n\n\n\n<li>New features like typed class constants<\/li>\n\n\n\n<li>Enhanced error handling<\/li>\n\n\n\n<li>Security improvements<\/li>\n\n\n\n<li>Bug fixes from the 8.2 branch<\/li>\n<\/ul>\n\n\n\n<p>Since my Raspberry Pi hosts this website as my personal hobby project, staying current with PHP versions is important for both security and performance. Plus, I enjoy learning about these upgrades!<\/p>\n\n\n\n<h2 id=\"the-reality-no-gui-just-terminal\" class=\"wp-block-heading\">The Reality: No GUI, Just Terminal<\/h2>\n\n\n\n<p>Unlike shared hosting providers with their shiny control panels, managing a Raspberry Pi web server means getting comfortable with the command line. There&#8217;s no upgrade button to click; everything happens through SSH and terminal commands. As a hobbyist, this was initially intimidating, but it&#8217;s become one of my favorite aspects of self-hosting!<\/p>\n\n\n\n<h2 id=\"prerequisites\" class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before starting, make sure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSH access to your Raspberry Pi<\/li>\n\n\n\n<li>Root or sudo privileges<\/li>\n\n\n\n<li>A backup of your website (always backup before major changes!!!)<\/li>\n\n\n\n<li>Basic familiarity with terminal commands<\/li>\n<\/ul>\n\n\n\n<h2 id=\"step-1-check-your-current-php-version\" class=\"wp-block-heading\">Step 1: Check Your Current PHP Version<\/h2>\n\n\n\n<p>First, let&#8217;s confirm what version we&#8217;re running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v\n<\/code><\/pre>\n\n\n\n<p>This should show PHP 8.2.x along with build information.<\/p>\n\n\n\n<h2 id=\"step-2-install-required-packages-for-adding-thirdparty-repositories\" class=\"wp-block-heading\">Step 2: Install Required Packages for Adding Third-Party Repositories<\/h2>\n\n\n\n<p>We need to install some packages that will help us add external repositories:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\n\nsudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg curl\n<\/code><\/pre>\n\n\n\n<h2 id=\"step-3-add-the-sury-php-repository\" class=\"wp-block-heading\">Step 3: Add the Sury PHP Repository<\/h2>\n\n\n\n<p>Raspberry Pi OS might not have PHP 8.3 in its default repositories yet, so we&#8217;ll add the Sury repository, which is the go-to source for updated PHP packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL https:\/\/packages.sury.org\/php\/apt.gpg | sudo gpg --dearmor -o \/etc\/apt\/trusted.gpg.d\/php.gpg\n\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" | sudo tee \/etc\/apt\/sources.list.d\/php.list\n\nsudo apt update\n<\/code><\/pre>\n\n\n\n<h2 id=\"step-4-install-php-83-and-required-modules\" class=\"wp-block-heading\">Step 4: Install PHP 8.3 and Required Modules<\/h2>\n\n\n\n<p>Now we can install PHP 8.3 with the Apache module and common extensions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y php8.3 libapache2-mod-php8.3 php8.3-cli php8.3-common php8.3-curl php8.3-gd php8.3-mbstring php8.3-xml php8.3-zip\n<\/code><\/pre>\n\n\n\n<p>These modules cover most web application needs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>libapache2-mod-php8.3<\/code> for Apache integration<\/li>\n\n\n\n<li><code>php8.3-gd<\/code> for image processing<\/li>\n\n\n\n<li><code>php8.3-curl<\/code> for HTTP requests<\/li>\n\n\n\n<li><code>php8.3-mbstring<\/code> for string handling<\/li>\n\n\n\n<li><code>php8.3-xml<\/code> for XML processing<\/li>\n\n\n\n<li><code>php8.3-zip<\/code> for archive handling<\/li>\n<\/ul>\n\n\n\n<h2 id=\"step-5-disable-the-old-php-version-optional\" class=\"wp-block-heading\">Step 5: Disable the Old PHP Version (Optional)<\/h2>\n\n\n\n<p>If PHP 8.2 was previously active in Apache, disable it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2dismod php8.2\n<\/code><\/pre>\n\n\n\n<p>Don&#8217;t worry if this command errors out, it just means PHP 8.2 wasn&#8217;t actively configured in Apache.<\/p>\n\n\n\n<h2 id=\"step-6-enable-php-83-in-apache\" class=\"wp-block-heading\">Step 6: Enable PHP 8.3 in Apache<\/h2>\n\n\n\n<p>Now enable the new PHP version and restart Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enmod php8.3\n\nsudo systemctl restart apache2\n<\/code><\/pre>\n\n\n\n<h2 id=\"step-7-confirm-php-is-upgraded\" class=\"wp-block-heading\">Step 7: Confirm PHP is Upgraded<\/h2>\n\n\n\n<p>Check that everything is working:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v\n<\/code><\/pre>\n\n\n\n<p>You should see output similar to: <code>PHP 8.3.x (cli) (built: ...)<\/code><\/p>\n\n\n\n<p>Also test your website in a browser to ensure it&#8217;s loading correctly with the new PHP version.<\/p>\n\n\n\n<h2 id=\"step-8-update-php-configuration-optional\" class=\"wp-block-heading\">Step 8: Update PHP Configuration (Optional)<\/h2>\n\n\n\n<p>Your old <code>php.ini<\/code> settings are in <code>\/etc\/php\/8.2\/<\/code>. You might want to copy relevant settings to the new version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/etc\/php\/8.2\/apache2\/php.ini \/etc\/php\/8.3\/apache2\/php.ini.backup\n\n# Then manually edit \/etc\/php\/8.3\/apache2\/php.ini as needed\n<\/code><\/pre>\n\n\n\n<p>Remember to restart Apache after any configuration changes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2\n<\/code><\/pre>\n\n\n\n<h2 id=\"troubleshooting-common-issues\" class=\"wp-block-heading\">Troubleshooting Common Issues<\/h2>\n\n\n\n<p><strong>Website shows errors after upgrade:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check PHP error logs: <code>sudo tail -f \/var\/log\/apache2\/error.log<\/code><\/li>\n\n\n\n<li>Ensure all required PHP extensions are installed<\/li>\n\n\n\n<li>Verify file permissions haven&#8217;t changed<\/li>\n<\/ul>\n\n\n\n<p><strong>Performance issues:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Consider updating your PHP configuration for better memory limits<\/li>\n\n\n\n<li>Check that OPcache is enabled in the new version<\/li>\n<\/ul>\n\n\n\n<h2 id=\"cleaning-up-optional\" class=\"wp-block-heading\">Cleaning Up (Optional)<\/h2>\n\n\n\n<p>Once you&#8217;re confident PHP 8.3 is working correctly, you can remove the old version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt remove php8.2*\n\nsudo apt autoremove\n<\/code><\/pre>\n\n\n\n<h2 id=\"final-thoughts\" class=\"wp-block-heading\">Final Thoughts<\/h2>\n\n\n\n<p>Upgrading PHP on a Raspberry Pi requires patience and terminal comfort, but it&#8217;s a valuable skill for anyone self-hosting as a hobby. The process reinforces why having backups is crucial and why understanding your server setup matters, lessons I&#8217;ve learned the hard way.<\/p>\n\n\n\n<p>The lack of a simple upgrade button might seem daunting at first, but it gives you complete control over your server environment. Plus, you learn exactly what&#8217;s happening under the hood. Knowledge that proves invaluable when troubleshooting issues down the road.<\/p>\n\n\n\n<p>My website is now running smoothly on PHP 8.3. The upgrade was well worth the effort, and now I&#8217;m better prepared for future PHP updates. Each time I do something like this, I feel more confident in my hobby server management skills \ud83d\ude42<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em>Running into issues with your PHP upgrade? Feel free to reach out in the comments below. As a fellow hobbyist, I&#8217;m happy to help other Raspberry Pi web server enthusiasts! We&#8217;re all learning together.<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"1024\" data-attachment-id=\"79\" data-permalink=\"https:\/\/www.patrickphang.nl\/index.php\/2025\/08\/07\/upgrading-php-from-8-2-to-8-3-on-raspberry-pi-a-hobbyists-command-line-adventure\/pat-php\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?fit=1024%2C1536&amp;ssl=1\" data-orig-size=\"1024,1536\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"pat php\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?fit=683%2C1024&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?resize=683%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-79\" srcset=\"https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?resize=683%2C1024&amp;ssl=1 683w, https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?resize=200%2C300&amp;ssl=1 200w, https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?resize=768%2C1152&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?w=1024&amp;ssl=1 1024w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Running a website on a Raspberry Pi is both rewarding and educational, especially when you&#8217;re doing it as a hobby like I am. I&#8217;m not a professional developer or system administrator, just someone who enjoys tinkering with technology in my spare time. But that comes with its own set of challenges! One of those challenges? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":79,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"Upgrade PHP on your Raspberry Pi running Apache and WordPress to boost speed, security, and compatibility with this easy step-by-step guide.\n","jetpack_seo_html_title":"How to Upgrade PHP on Raspberry Pi for WordPress with Apache","jetpack_seo_noindex":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-75","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hobby","category-tech"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.patrickphang.nl\/wp-content\/uploads\/2025\/08\/pat-php.jpg?fit=1024%2C1536&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":5,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions\/129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/media\/79"}],"wp:attachment":[{"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patrickphang.nl\/index.php\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}