{"id":15933,"date":"2026-08-29T14:33:43","date_gmt":"2026-08-29T13:33:43","guid":{"rendered":"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/"},"modified":"2026-08-29T14:33:43","modified_gmt":"2026-08-29T13:33:43","slug":"how-to-enable-php-short-tags-on-your-hosting-account-2","status":"publish","type":"post","link":"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/","title":{"rendered":"How to Enable PHP Short Tags on Your Hosting Account"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_87 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#How_to_Enable_PHP_Short_Tags_on_Your_Hosting_Account\" >How to Enable PHP Short Tags on Your Hosting Account<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#What_Are_PHP_Short_Tags\" >What Are PHP Short Tags?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Why_Are_PHP_Short_Tags_Disabled_by_Default\" >Why Are PHP Short Tags Disabled by Default?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#How_to_Check_If_PHP_Short_Tags_Are_Enabled\" >How to Check If PHP Short Tags Are Enabled<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Using_phpinfo_to_Check_Your_Settings\" >Using phpinfo() to Check Your Settings<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Methods_to_Enable_PHP_Short_Tags_on_Your_Hosting_Account\" >Methods to Enable PHP Short Tags on Your Hosting Account<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Method_1_Editing_the_phpini_File\" >Method 1: Editing the php.ini File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Method_2_Using_a_Custom_phpini_on_Shared_Hosting\" >Method 2: Using a Custom php.ini on Shared Hosting<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Method_3_Enabling_PHP_Short_Tags_via_htaccess\" >Method 3: Enabling PHP Short Tags via .htaccess<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Method_4_Using_cPanel_to_Modify_PHP_Settings\" >Method 4: Using cPanel to Modify PHP Settings<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Method_5_Contacting_Your_Hosting_Provider\" >Method 5: Contacting Your Hosting Provider<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#PHP_Short_Tags_on_VPS_and_Dedicated_Servers\" >PHP Short Tags on VPS and Dedicated Servers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Important_Considerations_When_Using_PHP_Short_Tags\" >Important Considerations When Using PHP Short Tags<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/da-manager.com\/blog\/how-to-enable-php-short-tags-on-your-hosting-account-2\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<p><html><br \/>\n<head><br \/>\n<title>How to Enable PHP Short Tags on Your Hosting Account<\/title><br \/>\n<\/head><br \/>\n<body><\/p>\n<h1><span class=\"ez-toc-section\" id=\"How_to_Enable_PHP_Short_Tags_on_Your_Hosting_Account\"><\/span>How to Enable PHP Short Tags on Your Hosting Account<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>If you have ever encountered errors when running older PHP scripts or working with legacy web applications, there is a good chance that PHP short tags could be the culprit. Understanding how PHP short tags work, why they are sometimes disabled by default, and how to enable them on your hosting account is an essential skill for any web developer or website owner. In this guide, we will walk you through everything you need to know about PHP short tags hosting, including practical steps to get them working on the most common hosting environments.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_Are_PHP_Short_Tags\"><\/span>What Are PHP Short Tags?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>PHP short tags are an alternative, abbreviated syntax for opening PHP code blocks. Instead of writing the standard opening tag <code>&lt;?php<\/code>, short tags allow you to simply write <code>&lt;?<\/code> to begin a block of PHP code. Similarly, the short echo tag <code>&lt;?=<\/code> can be used in place of <code>&lt;?php echo<\/code>.<\/p>\n<p>Here is a quick comparison of the two syntaxes:<\/p>\n<p><strong>Standard PHP tag:<\/strong> <code>&lt;?php echo \"Hello, World!\"; ?&gt;<\/code><\/p>\n<p><strong>Short tag equivalent:<\/strong> <code>&lt;?= \"Hello, World!\"; ?&gt;<\/code><\/p>\n<p>Short tags were commonly used in older PHP applications and frameworks, and many legacy codebases still rely on them. However, they have been a point of contention in the PHP community because they can cause conflicts with XML declarations, which also begin with <code>&lt;?<\/code>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_Are_PHP_Short_Tags_Disabled_by_Default\"><\/span>Why Are PHP Short Tags Disabled by Default?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Many hosting providers disable PHP short tags by default for a number of important reasons. Firstly, short tags can interfere with XML processing instructions, which start with the same <code>&lt;?<\/code> characters. This can lead to unexpected output or broken pages when XML and PHP are used together.<\/p>\n<p>Secondly, the PHP development team has historically discouraged the use of short tags to promote cleaner, more portable code. For a period, there was even discussion about removing short tags from future PHP versions entirely, although they remain available in current releases.<\/p>\n<p>Despite these concerns, there are still many legitimate reasons why you might need to enable PHP short tags on your hosting account, particularly if you are working with older scripts, third-party plugins, or inherited codebases that rely on this syntax.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Check_If_PHP_Short_Tags_Are_Enabled\"><\/span>How to Check If PHP Short Tags Are Enabled<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before making any changes, it is worth checking whether PHP short tags are already enabled on your server. The easiest way to do this is by creating a simple PHP info file.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Using_phpinfo_to_Check_Your_Settings\"><\/span>Using phpinfo() to Check Your Settings<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Create a new file called <code>phpinfo.php<\/code> and add the following code:<\/p>\n<p><code>&lt;?php phpinfo(); ?&gt;<\/code><\/p>\n<p>Upload this file to your web server and visit it in your browser. Search the page for <strong>short_open_tag<\/strong>. If the value shows <strong>On<\/strong>, short tags are already enabled. If it shows <strong>Off<\/strong>, you will need to enable them using one of the methods described below. Remember to delete this file after checking, as it can expose sensitive server information.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Methods_to_Enable_PHP_Short_Tags_on_Your_Hosting_Account\"><\/span>Methods to Enable PHP Short Tags on Your Hosting Account<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are several ways to enable PHP short tags depending on your hosting environment and the level of access you have. Below, we cover the most common approaches.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_1_Editing_the_phpini_File\"><\/span>Method 1: Editing the php.ini File<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The most straightforward way to enable PHP short tags is by editing the <code>php.ini<\/code> configuration file. This is the main configuration file for PHP and controls a wide range of settings.<\/p>\n<p>To enable short tags, locate the following line in your <code>php.ini<\/code> file:<\/p>\n<p><code>short_open_tag = Off<\/code><\/p>\n<p>Change it to:<\/p>\n<p><code>short_open_tag = On<\/code><\/p>\n<p>Save the file and restart your web server if you have the ability to do so. On shared hosting, changes to <code>php.ini<\/code> typically take effect immediately or after a short delay. If you cannot find an existing <code>php.ini<\/code> file, you may need to create one in the root directory of your hosting account or within the specific directory where your PHP files are located.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_2_Using_a_Custom_phpini_on_Shared_Hosting\"><\/span>Method 2: Using a Custom php.ini on Shared Hosting<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you are on shared hosting and do not have access to the server&#8217;s main <code>php.ini<\/code> file, you can often create a custom <code>php.ini<\/code> file in your website&#8217;s root directory or within a specific folder. Simply create a file named <code>php.ini<\/code> and add the following line:<\/p>\n<p><code>short_open_tag = On<\/code><\/p>\n<p>Upload this file to the appropriate directory. Note that this method does not work on all shared hosting providers, so you may need to check with your host to confirm whether custom <code>php.ini<\/code> files are supported.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_3_Enabling_PHP_Short_Tags_via_htaccess\"><\/span>Method 3: Enabling PHP Short Tags via .htaccess<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>For Apache-based hosting environments, you can enable PHP short tags using the <code>.htaccess<\/code> file. Add the following line to your existing <code>.htaccess<\/code> file or create a new one in your website&#8217;s root directory:<\/p>\n<p><code>php_value short_open_tag On<\/code><\/p>\n<p>This method is particularly useful for shared hosting environments where you do not have direct access to the <code>php.ini<\/code> file. However, it is worth noting that this approach only works if your hosting provider allows PHP directives to be set via <code>.htaccess<\/code>. Some hosts disable this for security reasons.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_4_Using_cPanel_to_Modify_PHP_Settings\"><\/span>Method 4: Using cPanel to Modify PHP Settings<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Many hosting accounts come with cPanel, which provides a graphical interface for managing your server settings. If your host offers cPanel, you can often adjust PHP settings directly from the control panel without needing to edit configuration files manually.<\/p>\n<p>To do this, log in to your cPanel account and look for the <strong>PHP Configuration<\/strong>, <strong>MultiPHP INI Editor<\/strong>, or <strong>Select PHP Version<\/strong> option. Within these tools, you should be able to find the <code>short_open_tag<\/code> directive and toggle it on. Once saved, the changes will apply to your hosting account immediately.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_5_Contacting_Your_Hosting_Provider\"><\/span>Method 5: Contacting Your Hosting Provider<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If none of the above methods work for your particular hosting environment, the simplest solution is to contact your hosting provider&#8217;s support team directly. Most reputable hosting companies will be able to enable PHP short tags on your account upon request, either globally or for a specific directory. When getting in touch, clearly explain that you need the <code>short_open_tag<\/code> directive set to <strong>On<\/strong> and provide the reason for your request.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"PHP_Short_Tags_on_VPS_and_Dedicated_Servers\"><\/span>PHP Short Tags on VPS and Dedicated Servers<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you are managing a VPS (Virtual Private Server) or a dedicated server, you will have full root access and can edit the main <code>php.ini<\/code> file directly. After making the change and saving the file, restart your web server using the appropriate command for your setup, such as <code>sudo service apache2 restart<\/code> for Apache or <code>sudo service nginx restart<\/code> for Nginx with PHP-FPM. This will apply the changes across the entire server.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Important_Considerations_When_Using_PHP_Short_Tags\"><\/span>Important Considerations When Using PHP Short Tags<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before enabling PHP short tags on your hosting account, there are a few important points to bear in mind. Whilst short tags can solve compatibility issues with legacy code, they are not recommended for new development projects. Modern PHP best practices favour the use of full <code>&lt;?php<\/code> tags to ensure maximum portability and compatibility across different server environments.<\/p>\n<p>If you are planning to distribute your code or work in a team environment, relying on short tags can create problems when your code is deployed on servers where they are disabled. It is generally better to update legacy code to use standard PHP tags wherever possible.<\/p>\n<p>For more useful guides on managing your hosting environment and web applications, visit the <a href=\"https:\/\/da-manager.com\/blog\" target=\"_blank\">DA Manager blog<\/a>, where you will find a wealth of practical tutorials and hosting tips.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Enabling PHP short tags on your hosting account is a straightforward process once you know which method suits your server environment. Whether you opt to edit your <code>php.ini<\/code> file, use <code>.htaccess<\/code>, adjust settings through cPanel, or contact your hosting provider, there is a solution available for virtually every type of hosting setup. Understanding PHP short tags hosting is particularly valuable when working with older codebases or troubleshooting compatibility issues. Just remember to use short tags responsibly and consider migrating to standard PHP syntax for any new projects you undertake.<\/p>\n<p><\/body><br \/>\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Enable PHP Short Tags on Your Hosting Account<\/p>\n<p>How to Enable PHP Short Tags on Your Hosting Account<\/p>\n<p>If you have ever encountered errors when running older PHP scripts or working with legacy web applications, there is a good chance that PHP short tags could be the culprit. Understanding h<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mbp_gutenberg_autopost":false,"footnotes":""},"categories":[147],"tags":[],"class_list":["post-15933","post","type-post","status-publish","format-standard","category-general"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts\/15933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/comments?post=15933"}],"version-history":[{"count":0,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts\/15933\/revisions"}],"wp:attachment":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/media?parent=15933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/categories?post=15933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/tags?post=15933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}