
{"id":24612,"date":"2025-07-22T11:19:03","date_gmt":"2025-07-22T09:19:03","guid":{"rendered":"https:\/\/contabo.com\/blog\/?p=24612"},"modified":"2025-07-10T11:43:03","modified_gmt":"2025-07-10T09:43:03","slug":"configure-php-settings-server","status":"publish","type":"post","link":"https:\/\/contabo.com\/blog\/configure-php-settings-server\/","title":{"rendered":"How to Configure PHP Settings on Your Server: A Clear and Practical Guide\u00a0"},"content":{"rendered":"\n<div class=\"wp-block-uagb-image uagb-block-27206f6a wp-block-uagb-image--layout-default wp-block-uagb-image--effect-static wp-block-uagb-image--align-none\"><figure class=\"wp-block-uagb-image__figure\"><img decoding=\"async\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png ,https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png 780w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png 360w\" sizes=\"auto, (max-width: 480px) 150px\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png\" alt=\"\" class=\"uag-image-24613\" width=\"1200\" height=\"630\" title=\"PHP\" loading=\"lazy\" role=\"img\"\/><\/figure><\/div>\n\n\n\n<p>PHP powers most dynamic websites today, from popular content management systems like WordPress and Joomla to custom-built applications. To ensure your site runs smoothly and efficiently, sometimes you need to adjust PHP\u2019s behavior, whether that means increasing memory limits, allowing larger file uploads, or extending script execution times. These settings are controlled through the php.ini configuration file on your server.&nbsp;<\/p>\n\n\n\n<p>This post explains how to locate, edit, and apply PHP settings on your server, based on Contabo\u2019s tutorial and official guidance.&nbsp;&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-php-and-why-configure-its-settings\">What Is PHP and Why Configure Its Settings?\u00a0<\/h2>\n\n\n\n<p>PHP (Hypertext Preprocessor) is the scripting language behind many interactive and dynamic websites. It handles everything from user logins and form submissions to database interactions.&nbsp;<\/p>\n\n\n\n<p>The php.ini file is PHP\u2019s main configuration file. It controls important aspects like:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How much memory PHP scripts can use (memory_limit)\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The maximum size of uploaded files (upload_max_filesize)\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The maximum size of POST requests (post_max_size)\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How long scripts are allowed to run (max_execution_time)\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Whether PHP displays errors (display_errors), useful for debugging\u00a0<\/li>\n<\/ul>\n\n\n\n<p>Tweaking these settings helps your website perform better and avoid common errors related to resource limits.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-1-identify-your-php-version-and-configuration-file-location\">Step 1: Identify Your PHP Version and Configuration File Location\u00a0<\/h2>\n\n\n\n<p>Before editing, you need to know which PHP version your server uses. Run this command in your terminal:&nbsp;<\/p>\n\n\n\n<p>&nbsp;<br>bash&nbsp;<br>php -v&nbsp;<br>&nbsp;<\/p>\n\n\n\n<p>This will display the PHP version number, which helps you locate the correct configuration file.&nbsp;<\/p>\n\n\n\n<p>Depending on your server setup, the main php.ini file is usually found in one of these locations:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For Apache:\u00a0<br>\/etc\/php\/[version]\/apache2\/php.ini\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For PHP-FPM (commonly used with NGINX):\u00a0<br>\/etc\/php\/[version]\/fpm\/php.ini\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For command-line PHP:\u00a0<br>\/etc\/php\/[version]\/cli\/php.ini\u00a0<\/li>\n<\/ul>\n\n\n\n<p>Replace [version] with your PHP version (e.g., 8.1)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-open-and-edit-the-php-ini-file\">Step 2: Open and Edit the php.ini File\u00a0<\/h2>\n\n\n\n<p>Use a text editor like nano to open the file. For example, if you\u2019re using PHP-FPM version 8.1:&nbsp;<\/p>\n\n\n\n<p>&nbsp;<br>bash&nbsp;<br>sudo nano \/etc\/php\/8.1\/fpm\/php.ini&nbsp;<br>&nbsp;<\/p>\n\n\n\n<p>Inside the file, you can search for specific settings by pressing CTRL + W and typing the setting name.&nbsp;<\/p>\n\n\n\n<p>Here are some common settings you might want to adjust:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>memory_limit \u2014 Controls how much RAM PHP scripts can use.\u00a0<br>Example:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>text&nbsp;<br>memory_limit = 256M&nbsp;<br>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>upload_max_filesize \u2014 Maximum size of uploaded files.\u00a0<br>Example:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>text&nbsp;<br>upload_max_filesize = 64M&nbsp;<br>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>post_max_size \u2014 Maximum size of POST data, including file uploads.\u00a0<br>Example:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>text&nbsp;<br>post_max_size = 64M&nbsp;<br>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>max_execution_time \u2014 Maximum time a script is allowed to run (in seconds).\u00a0<br>Example:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>text&nbsp;<br>max_execution_time = 60&nbsp;<br>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>display_errors \u2014 Show errors on the screen (useful during development).\u00a0<br>Example:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>text&nbsp;<br>display_errors = On&nbsp;<br>&nbsp;<\/p>\n\n\n\n<p>Make the necessary changes by editing the values, then save (CTRL + O) and exit (CTRL + X).&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-restart-php-and-your-web-server\">Step 3: Restart PHP and Your Web Server\u00a0<\/h2>\n\n\n\n<p>For your changes to take effect, restart PHP and your web server.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you use PHP-FPM with NGINX, run:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>bash&nbsp;<br>sudo systemctl restart php8.1-fpm&nbsp;<br>sudo systemctl reload nginx&nbsp;<br>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you use Apache, run:\u00a0<\/li>\n<\/ul>\n\n\n\n<p>bash&nbsp;<br>sudo systemctl restart apache2&nbsp;<br>&nbsp;<\/p>\n\n\n\n<p>Make sure to replace 8.1 with your actual PHP version.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-4-verify-your-changes\">Step 4: Verify Your Changes\u00a0<\/h2>\n\n\n\n<p>To confirm your new PHP settings are active, create a simple PHP info file in your website\u2019s root directory:&nbsp;<\/p>\n\n\n\n<p>php&nbsp;<br>&lt;?php phpinfo(); ?&gt;&nbsp;<br>&nbsp;<\/p>\n\n\n\n<p>Save this as info.php and access it in your browser at <a href=\"http:\/\/yourdomain.com\/info.php\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">http:\/\/yourdomain.com\/info.php<\/a>. This page displays all current PHP configuration values, including those you just changed.&nbsp;<\/p>\n\n\n\n<p>Important: Delete this file after checking, as it exposes sensitive server information.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-additional-tips\">Additional Tips\u00a0<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always back up your php.ini file before making changes.\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Only enable display_errors on development or staging servers to avoid exposing errors to visitors.\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you\u2019re unsure which php.ini file is active, the phpinfo() page shows the \u201cLoaded Configuration File\u201d path.\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For advanced setups, you might also want to check PHP-FPM pool configuration files for per-pool settings.\u00a0<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-summary\">Summary<\/h2>\n\n\n\n<p>Configuring PHP settings allows you to tailor your server environment to your website\u2019s specific needs. By editing the php.ini file and restarting your services, you can improve performance, increase upload limits, and troubleshoot issues more effectively.&nbsp;<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"h-for-a-detailed-visual-guide-watch-the-contabo-tutorial-here\"><strong>For a detailed visual guide, watch the Contabo tutorial here:\u00a0<\/strong><\/h5>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container \" style=\"height: 100%;\"><iframe loading=\"lazy\" title=\"How to configure PHP settings on your server\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/ES0USU3fmHo?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-helpful-resources\">Helpful Resources:\u00a0<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Contabo Support Center: <a href=\"https:\/\/contabo.com\/support\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/contabo.com\/support<\/a>\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Contabo Tutorials: <a href=\"https:\/\/contabo.com\/blog\/tutorials\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/contabo.com\/blog\/tutorials\/<\/a>\u00a0<\/li>\n<\/ul>\n\n\n\n<p>Fine-tuning your PHP environment is a straightforward way to keep your website running smoothly and efficiently.&nbsp;<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP powers most dynamic websites today, from popular content management systems like WordPress and Joomla to custom-built applications. To ensure your site runs smoothly and efficiently, sometimes you need to adjust PHP\u2019s behavior, whether that means increasing memory limits, allowing larger file uploads, or extending script execution times. These settings are controlled through the php.ini [&hellip;]<\/p>\n","protected":false},"author":75,"featured_media":24613,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[18],"tags":[181,2942,2940,2941,1757,1755,2943,894],"ppma_author":[2060],"class_list":["post-24612","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-contabo","tag-memory-limit","tag-php-configuration","tag-php-ini-settings","tag-server-optimization","tag-server-setup","tag-upload-size","tag-vps"],"uagb_featured_image_src":{"full":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png",1200,630,false],"thumbnail":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP-150x150.png",150,150,true],"medium":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP-600x315.png",600,315,true],"medium_large":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP-768x403.png",768,403,true],"large":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png",1200,630,false],"1536x1536":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png",1200,630,false],"2048x2048":["https:\/\/contabo.com\/blog\/wp-content\/uploads\/2025\/07\/PHP.png",1200,630,false]},"uagb_author_info":{"display_name":"Rajani Bhatia","author_link":"https:\/\/contabo.com\/blog\/author\/rajani\/"},"uagb_comment_info":0,"uagb_excerpt":"PHP powers most dynamic websites today, from popular content management systems like WordPress and Joomla to custom-built applications. To ensure your site runs smoothly and efficiently, sometimes you need to adjust PHP\u2019s behavior, whether that means increasing memory limits, allowing larger file uploads, or extending script execution times. These settings are controlled through the php.ini&hellip;","authors":[{"term_id":2060,"user_id":75,"is_guest":0,"slug":"rajani","display_name":"Rajani Bhatia","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/939b00d29904c7213420c8048b694bd858214248e653e6d612216eb2ff4bc1f5?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/24612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/comments?post=24612"}],"version-history":[{"count":3,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/24612\/revisions"}],"predecessor-version":[{"id":24757,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/24612\/revisions\/24757"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media\/24613"}],"wp:attachment":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media?parent=24612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/categories?post=24612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/tags?post=24612"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=24612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}