{"id":819,"date":"2024-06-27T10:17:07","date_gmt":"2024-06-27T10:17:07","guid":{"rendered":"https:\/\/serverspros.com\/?post_type=glossary&#038;p=819"},"modified":"2024-06-27T18:49:56","modified_gmt":"2024-06-27T18:49:56","slug":"php-ini","status":"publish","type":"glossary","link":"https:\/\/serverspros.com\/en\/wiki\/php-ini\/","title":{"rendered":"php.ini"},"content":{"rendered":"<h1>Editing php.ini: The Definitive Guide<\/h1>\n<h2>What is php.ini?<\/h2>\n<p>The file <strong><span class=\"glossary-tooltip glossary-term-797\"><span class=\"glossary-link\"><a href=\"https:\/\/serverspros.com\/en\/wiki\/php\/\" target=\"_blank\">php<\/a><\/span><span class=\"hidden glossary-tooltip-content clearfix\"><span class=\"glossary-tooltip-text\">PHP is an open-source programming language used primarily for server-side web development. Created in 1994 by Rasmus Lerdorf, PHP allows for the generation of dynamic and interactive web pages. Thanks to its large community and continuous updates, it remains a popular choice among developers....<\/span><\/span><\/span>.ini<\/strong> is a configuration file used by <strong>PHP<\/strong>, a widely used programming language for server-side web development. This file allows system administrators and developers to define various directives that affect PHP's behavior in web applications. The configuration in php.ini includes aspects such as the maximum size of uploaded files, the amount of memory a script can use, and error_reporting directives, among others.<\/p>\n<h2>Why Edit php.ini?<\/h2>\n<p>Modifying the php.ini file may be necessary for several reasons:<\/p>\n<ol>\n<li><strong>Performance Optimization:<\/strong> Proper configurations can improve the speed and efficiency of your PHP applications.<\/li>\n<li><strong>Security:<\/strong> Adjustments like disabling insecure functions or limiting the exposure of error information can protect your server.<\/li>\n<li><strong>Customization:<\/strong> Adapting the configuration to the specific needs of your website or web application.<\/li>\n<\/ol>\n<h2>Location of the php.ini File<\/h2>\n<p>The exact location of the php.ini file can vary depending on the operating system and the PHP installation you are using. Commonly, you can find it in directories such as:<\/p>\n<ul>\n<li><strong>Linux:<\/strong> <code>\/etc\/php\/{version}\/apache2\/php.ini<\/code> (if you use Apache) or <code>\/etc\/php\/{version}\/fpm\/php.ini<\/code> (if you use PHP-FPM)<\/li>\n<li><strong>Windows:<\/strong> <code>C:xamppphpphp.ini<\/code> o <code>C:wampphpphp.ini<\/code><\/li>\n<\/ul>\n<p>You can find the exact location by running the following command in your command terminal:<\/p>\n<pre><code class=\"language-sh\">php --ini<\/code><\/pre>\n<h2>Editing php.ini in Virtualmin<\/h2>\n<h3>Step 1: Accessing Virtualmin<\/h3>\n<p>First, access your <strong><span class=\"glossary-tooltip glossary-term-786\"><span class=\"glossary-link\"><a href=\"https:\/\/serverspros.com\/en\/wiki\/virtualmin\/\" target=\"_blank\">Virtualmin<\/a><\/span><span class=\"hidden glossary-tooltip-content clearfix\"><span class=\"glossary-tooltip-text\">Virtualmin is an advanced web server administration tool that simplifies the management of multiple virtual hosts through an intuitive web interface. Developed as a module of Webmin, a popular web-based system administration system, Virtualmin is primarily used to manage web services and... <a href=\"https:\/\/serverspros.com\/en\/wiki\/virtualmin\/\">More<\/a><\/span><\/span><\/span><\/strong>. interface. Virtualmin is a powerful hosting management tool that allows you to easily manage servers and websites.<\/p>\n<h3>Step 2: Select the Domain<\/h3>\n<p>In the Virtualmin panel, select the domain or virtual server for which you need to modify php.ini.<\/p>\n<h3>Step 3: Access PHP Configuration<\/h3>\n<p>Navigate to <strong>\"Services\"<\/strong> and then select <strong>\"PHP Configuration\"<\/strong>. Here you can see the current directives of the php.ini file that can be modified.<\/p>\n<h3>Step 4: Edit Directives<\/h3>\n<p>Make the necessary changes to the directives. Some of the most commonly adjusted directives include:<\/p>\n<ul>\n<li><strong>memory_limit:<\/strong> Defines the maximum amount of memory a script can consume.<\/li>\n<li><strong><span class=\"glossary-tooltip glossary-term-806\"><span class=\"glossary-link\"><a href=\"https:\/\/serverspros.com\/en\/wiki\/upload_max_filesize\/\" target=\"_blank\">upload_max_filesize<\/a><\/span><span class=\"hidden glossary-tooltip-content clearfix\"><span class=\"glossary-tooltip-text\">The \"upload_max_filesize\" parameter in PHP defines the maximum allowed size for files uploaded to a server. It is crucial for managing the upload of large files and is adjusted in the php.ini file. Modifying this value can improve the functionality of web applications that require uploading large documents or images of great...<\/span><\/span><\/span>:<\/strong> Sets the maximum size for uploaded files.<\/li>\n<li><strong>post_max_size:<\/strong> Configures the maximum allowed size for POST data.<\/li>\n<li><strong>max_execution_time:<\/strong> Specifies the maximum time in seconds a script can run before being terminated by the parser.<\/li>\n<\/ul>\n<p>For example, to change the memory limit and the maximum uploaded file size, you could modify the following lines:<\/p>\n<pre><code class=\"language-ini\">memory_limit = 256M\nupload_max_filesize = 50M\npost_max_size = 50M<\/code><\/pre>\n<h3>Step 5: Save and Restart<\/h3>\n<p>After making changes, save the file. It is important to restart the web server for the changes to take effect. This can be done from the Virtualmin panel itself or via the command line:<\/p>\n<p>For Apache:<\/p>\n<pre><code class=\"language-sh\">sudo systemctl restart apache2<\/code><\/pre>\n<p>To <span class=\"glossary-tooltip glossary-term-825\"><span class=\"glossary-link\"><a href=\"https:\/\/serverspros.com\/en\/wiki\/nginx\/\" target=\"_blank\">Nginx<\/a><\/span><span class=\"hidden glossary-tooltip-content clearfix\"><span class=\"glossary-tooltip-text\">Nginx is an open-source web server known for its high performance and low resource utilization. Favored by both small websites and large enterprises, Nginx also acts as a reverse proxy, load balancer, and content cache, significantly improving the efficiency and speed of web applications....<\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-sh\">sudo systemctl restart nginx<\/code><\/pre>\n<h2>Security Considerations<\/h2>\n<h3>Disabling Insecure Functions<\/h3>\n<p>To improve security, you might want to disable certain potentially dangerous functions. This can be done by adding the following lines in the php.ini file:<\/p>\n<pre><code class=\"language-ini\">disable_functions = exec,passthru,shell_exec,system<\/code><\/pre>\n<h3>Error Configuration<\/h3>\n<p>Modifying error handling directives can also be crucial for security:<\/p>\n<pre><code class=\"language-ini\">display_errors = Off\nlog_errors = On\nerror_log = \/var\/log\/php_errors.log<\/code><\/pre>\n<p>These configurations help prevent errors from being displayed to the end-user, which could provide sensitive information about your server, and instead, errors are logged to a file for review.<\/p>\n<h2>Useful Tools<\/h2>\n<p>There are various tools and extensions that can facilitate the editing and administration of php.ini:<\/p>\n<ul>\n<li><strong>phpinfo():<\/strong> A PHP function that displays all configuration information, ideal for verifying changes.<\/li>\n<li><strong>PHP Configuration Editors in cPanel or <span class=\"glossary-tooltip glossary-term-856\"><span class=\"glossary-link\"><a href=\"https:\/\/serverspros.com\/en\/wiki\/plesk\/\" target=\"_blank\">Plesk<\/a><\/span><span class=\"hidden glossary-tooltip-content clearfix\"><span class=\"glossary-tooltip-text\">Plesk is a server administration platform that allows you to manage websites, emails, and applications from a unified interface. Compatible with operating systems like Linux and Windows, Plesk offers intuitive tools to facilitate tasks such as domain setup, security, and database management,...<\/span><\/span><\/span>:<\/strong> If you do not use Virtualmin, these tools may offer graphical interfaces to edit php.ini.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>The php.ini file is a crucial component in PHP configuration, and correctly editing it can have a significant impact on the performance, security, and functionality of your web applications. Using tools like <strong>Virtualmin<\/strong>, you can simplify this process and ensure your configuration is optimized for your specific needs. Always remember to make backups before making changes and test adjustments in a development environment before applying them in production.<\/p>","protected":false},"excerpt":{"rendered":"<p>Edit the file <span class=\"glossary-tooltip glossary-term-797\"><span class=\"glossary-link\"><a href=\"https:\/\/serverspros.com\/en\/wiki\/php\/\" target=\"_blank\">php<\/a><\/span><span class=\"hidden glossary-tooltip-content clearfix\"><span class=\"glossary-tooltip-text\">PHP is an open-source programming language used primarily for server-side web development. Created in 1994 by Rasmus Lerdorf, PHP allows for the generation of dynamic and interactive web pages. Thanks to its large community and continuous updates, it remains a popular choice among developers....<\/span><\/span><\/span>.The .ini file is fundamental for configuring PHP guidelines on your server. This file controls aspects such as the maximum file upload size, script execution time, and security directives. Make sure to restart the server after making changes for them to take effect.<\/p>","protected":false},"author":1,"featured_media":919,"parent":0,"template":"","glossary-cat":[],"class_list":["post-819","glossary","type-glossary","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>php.ini - ServersPros<\/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:\/\/serverspros.com\/en\/wiki\/php-ini\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"php.ini - ServersPros\" \/>\n<meta property=\"og:description\" content=\"Editar el archivo php.ini es fundamental para configurar las directrices de PHP en tu servidor. Este archivo controla aspectos como el tama\u00f1o m\u00e1ximo de archivos para subida, el tiempo de ejecuci\u00f3n de scripts y las directivas de seguridad. Aseg\u00farate de reiniciar el servidor despu\u00e9s de realizar cambios para que estos surtan efecto.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/serverspros.com\/en\/wiki\/php-ini\/\" \/>\n<meta property=\"og:site_name\" content=\"ServersPros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-27T18:49:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/serverspros.com\/wiki\/php-ini\/\",\"url\":\"https:\/\/serverspros.com\/wiki\/php-ini\/\",\"name\":\"php.ini - ServersPros\",\"isPartOf\":{\"@id\":\"https:\/\/serverspros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/serverspros.com\/wiki\/php-ini\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/serverspros.com\/wiki\/php-ini\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg\",\"datePublished\":\"2024-06-27T10:17:07+00:00\",\"dateModified\":\"2024-06-27T18:49:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/serverspros.com\/wiki\/php-ini\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/serverspros.com\/wiki\/php-ini\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/serverspros.com\/wiki\/php-ini\/#primaryimage\",\"url\":\"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg\",\"contentUrl\":\"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg\",\"width\":800,\"height\":600,\"caption\":\"editar-php-ini-2-8585178\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/serverspros.com\/wiki\/php-ini\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\/\/serverspros.com\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Glossary\",\"item\":\"https:\/\/serverspros.com\/de\/wiki\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"php.ini\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/serverspros.com\/#website\",\"url\":\"https:\/\/serverspros.com\/\",\"name\":\"ServersPros\",\"description\":\"Tutoriales de servidores y VirtualMin\",\"publisher\":{\"@id\":\"https:\/\/serverspros.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/serverspros.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/serverspros.com\/#organization\",\"name\":\"serverspros\",\"url\":\"https:\/\/serverspros.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/serverspros.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/Systempeaker_logo_blanco-3193993.webp\",\"contentUrl\":\"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/Systempeaker_logo_blanco-3193993.webp\",\"width\":556,\"height\":114,\"caption\":\"serverspros\"},\"image\":{\"@id\":\"https:\/\/serverspros.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"php.ini - ServersPros","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:\/\/serverspros.com\/en\/wiki\/php-ini\/","og_locale":"en_US","og_type":"article","og_title":"php.ini - ServersPros","og_description":"Editar el archivo php.ini es fundamental para configurar las directrices de PHP en tu servidor. Este archivo controla aspectos como el tama\u00f1o m\u00e1ximo de archivos para subida, el tiempo de ejecuci\u00f3n de scripts y las directivas de seguridad. Aseg\u00farate de reiniciar el servidor despu\u00e9s de realizar cambios para que estos surtan efecto.","og_url":"https:\/\/serverspros.com\/en\/wiki\/php-ini\/","og_site_name":"ServersPros","article_modified_time":"2024-06-27T18:49:56+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/serverspros.com\/wiki\/php-ini\/","url":"https:\/\/serverspros.com\/wiki\/php-ini\/","name":"php.ini - ServersPros","isPartOf":{"@id":"https:\/\/serverspros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/serverspros.com\/wiki\/php-ini\/#primaryimage"},"image":{"@id":"https:\/\/serverspros.com\/wiki\/php-ini\/#primaryimage"},"thumbnailUrl":"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg","datePublished":"2024-06-27T10:17:07+00:00","dateModified":"2024-06-27T18:49:56+00:00","breadcrumb":{"@id":"https:\/\/serverspros.com\/wiki\/php-ini\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/serverspros.com\/wiki\/php-ini\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/serverspros.com\/wiki\/php-ini\/#primaryimage","url":"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg","contentUrl":"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/editar-php-ini_819-9207302.jpg","width":800,"height":600,"caption":"editar-php-ini-2-8585178"},{"@type":"BreadcrumbList","@id":"https:\/\/serverspros.com\/wiki\/php-ini\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/serverspros.com\/de\/"},{"@type":"ListItem","position":2,"name":"Glossary","item":"https:\/\/serverspros.com\/de\/wiki\/"},{"@type":"ListItem","position":3,"name":"php.ini"}]},{"@type":"WebSite","@id":"https:\/\/serverspros.com\/#website","url":"https:\/\/serverspros.com\/","name":"ServersPros","description":"Server and VirtualMin Tutorials","publisher":{"@id":"https:\/\/serverspros.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/serverspros.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/serverspros.com\/#organization","name":"serverspros","url":"https:\/\/serverspros.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/serverspros.com\/#\/schema\/logo\/image\/","url":"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/Systempeaker_logo_blanco-3193993.webp","contentUrl":"https:\/\/serverspros.com\/wp-content\/uploads\/2024\/06\/Systempeaker_logo_blanco-3193993.webp","width":556,"height":114,"caption":"serverspros"},"image":{"@id":"https:\/\/serverspros.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/glossary\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/glossary"}],"about":[{"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/types\/glossary"}],"author":[{"embeddable":true,"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":2,"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/glossary\/819\/revisions"}],"predecessor-version":[{"id":1010,"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/glossary\/819\/revisions\/1010"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/media\/919"}],"wp:attachment":[{"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/media?parent=819"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/serverspros.com\/en\/wp-json\/wp\/v2\/glossary-cat?post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}