{"id":724,"date":"2012-08-06T04:31:22","date_gmt":"2012-08-06T10:31:22","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=724"},"modified":"2026-03-24T23:27:50","modified_gmt":"2026-03-25T05:27:50","slug":"how-to-fix-error-deprecated-function-set_magic_quotes_runtime","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/how-to-fix-error-deprecated-function-set_magic_quotes_runtime\/","title":{"rendered":"How to fix error &#8220;Deprecated: Function set_magic_quotes_runtime()&#8221;?"},"content":{"rendered":"\n<p>If you encounter the error <strong>\u201cDeprecated: Function set_magic_quotes_runtime()\u201d<\/strong> in your PHP application, it means your code is using a function that is no longer supported in modern PHP versions. This issue commonly appears after upgrading PHP, especially when moving to PHP 5.4 or later.<\/p>\n\n\n\n<p>Understanding why this error occurs and how to fix it will help you ensure your application runs smoothly on newer PHP environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What Causes This Error?<\/strong><\/h2>\n\n\n\n<p>The function <code>set_magic_quotes_runtime()<\/code> was part of older PHP versions and was used to automatically escape special characters in database queries. However, due to performance issues and better alternatives, it was:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Deprecated in PHP 5.3<\/strong><\/li>\n\n\n\n<li><strong>Removed completely in PHP 5.4 and later<\/strong><\/li>\n<\/ul>\n\n\n\n<p>As a result, any application still using this function will trigger a deprecated warning or even a fatal error in newer PHP versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Fix the Error<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Remove the Deprecated Function<\/strong><\/h3>\n\n\n\n<p>Search your codebase for:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set_magic_quotes_runtime();<\/code><\/pre>\n\n\n\n<p>Simply remove or comment out this line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ set_magic_quotes_runtime();<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Replace with Proper Data Handling<\/strong><\/h3>\n\n\n\n<p>Instead of relying on magic quotes, use secure and modern methods for handling user input:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <strong>prepared statements<\/strong> (PDO or MySQLi)<\/li>\n\n\n\n<li>Apply proper escaping functions like: mysqli_real_escape_string()<\/li>\n\n\n\n<li>Validate and sanitize all user inputs<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Check for Related Functions<\/strong><\/h3>\n\n\n\n<p>Also look for other deprecated functions such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>get_magic_quotes_runtime();<\/code><\/pre>\n\n\n\n<p>These should also be removed from your code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Update Legacy Applications<\/strong><\/h3>\n\n\n\n<p>If you are using an older CMS, plugin, or custom script, make sure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It is updated to the latest version<\/li>\n\n\n\n<li>It supports your current PHP version<\/li>\n<\/ul>\n\n\n\n<p>Outdated software often contains deprecated functions that cause such errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. (Temporary) Disable Error Display<\/strong><\/h3>\n\n\n\n<p>If needed, you can hide deprecated warnings temporarily (not recommended for long-term use):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>error_reporting(E_ALL &amp; ~E_DEPRECATED);<\/code><\/pre>\n\n\n\n<p>This only suppresses the warning but does not fix the root cause.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>The <strong>\u201cDeprecated: Function set_magic_quotes_runtime()\u201d<\/strong> error occurs because the function has been removed from modern PHP versions. The best solution is to remove it completely and adopt secure coding practices like prepared statements and proper input validation.<\/p>\n\n\n\n<p>Keeping your codebase updated and following modern PHP standards will help prevent such errors and improve the overall security and performance of your application.<\/p>\n\n\n\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a>&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Facing issues? <\/p>\n\n\n\n<p class=\"has-large-font-size\">Our technical support<br>engineers can solve it. <\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you encounter the error \u201cDeprecated: Function set_magic_quotes_runtime()\u201d in your PHP application, it means your code is using a function that is no longer supported in modern PHP versions. This&hellip;<\/p>\n","protected":false},"author":4,"featured_media":16534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-724","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=724"}],"version-history":[{"count":7,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/724\/revisions"}],"predecessor-version":[{"id":16535,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/724\/revisions\/16535"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/16534"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}