{"id":23209,"date":"2020-12-09T10:07:21","date_gmt":"2020-12-09T02:07:21","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&#038;p=23209"},"modified":"2022-09-08T20:00:22","modified_gmt":"2022-09-08T12:00:22","slug":"security-update-disabled-php-functions","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/security-update-disabled-php-functions","title":{"rendered":"Disabled PHP Functions"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"23209\" class=\"elementor elementor-23209\" data-elementor-post-type=\"kb\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8a54aaf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8a54aaf\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a4000f5\" data-id=\"a4000f5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3c34b3a elementor-widget elementor-widget-heading\" data-id=\"3c34b3a\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Disabled PHP Functions<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3f72543 elementor-widget elementor-widget-text-editor\" data-id=\"3f72543\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>We have disabled PHP features to improve safety on our <a href=\"https:\/\/www.casbay.com\/business-hosting\">shared hosting<\/a> servers:<\/p><p>\u2013 exec<br \/>\u2013 passthru<br \/>\u2013 shell_exec<br \/>\u2013 system<br \/>\u2013 proc_open<br \/>\u2013 popen<br \/>\u2013 curl_exec<br \/>\u2013 curl_multi_exec<br \/>\u2013 parse_ini_file<br \/>\u2013 show_source<\/p><p>Please create a php.ini file in your public_html directory if you want to use the above PHP features on your website and add below line:<\/p><p>\u201cdisable_functions =\u201d (without double quotes)<\/p><p>You can generate a blank text file with the name of \u201cphp.ini\u201d in your public html if you do not understand how to generate php.ini (php custom file setup). This settings file will override your website\u2019s present PHP settings.<\/p><p>This enables the default in a single domain setting.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-51f3823 elementor-widget elementor-widget-heading\" data-id=\"51f3823\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-medium\">Why are PHP Functions dangerous?<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6696dd9 elementor-widget elementor-widget-text-editor\" data-id=\"6696dd9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Seriously, almost any PHP function can be dangerous given the right context. The function- <code>strlen<\/code> and like are probably safe, but any function that talks to the outside world can bring surprises if the rest of the code is not safe. You can check the list of dangerous PHP functions here: <a href=\"http:\/\/php.net\/manual\" rel=\"noopener\">http:\/\/php.net\/manual<\/a>\u00a0.<\/p><ul><li>If you want to <strong>secure<\/strong> the site, the security should be throughout the code. If you just disable some function here and there is not going to work. However, it is only going to blind you and lead to sloppy coding.<\/li><li>There are capabilities in PHP that can\u00a0<em>assist<\/em> you in writing more secure code. However, they won&#8217;t make secure code from insecure ones. Look for <a href=\"http:\/\/us2.php.net\/manual\/en\/ini.core.php#ini.open-basedir\" rel=\"noopener\">open_basedir<\/a>\u00a0and\u00a0<a href=\"http:\/\/us.php.net\/manual\/en\/filesystem.configuration.php#ini.allow-url-fopen\" rel=\"noopener\">allow_url_fopen<\/a>\u00a0as an example.<\/li><li>Besides that, you can use <code>disable_functions<\/code> to prohibit some actions that you consider dangerous. However, only certain classes of actions can be inhibited this way. For example, you can disable and this probably will prevent running external programs from your code. Nonetheless, most of the things done by these programs can be done by PHP means too.<\/li><li>Moreover, trying to avoid things like &#8220;writing a file&#8221; probably won&#8217;t work. You should do it via OS permissions instead, not via PHP. So, define what exactly do you want to prohibit first. Then, see if it&#8217;s possible &#8211; while keeping in mind it may be impossible.<\/li><li>Unfortunately, security is not done by just setting <code>security=On<\/code>\u00a0in\u00a0<code>php.ini<\/code>.\u00a0 Therefore, you can read the <a href=\"http:\/\/php.net\/manual\/en\/security.php\" rel=\"noopener\">security chapter<\/a> in the PHP manual and some <a href=\"http:\/\/phpsecurity.org\/\" rel=\"noopener\">PHP security books<\/a>.<\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ef7641a elementor-widget elementor-widget-text-editor\" data-id=\"ef7641a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Thanks for reading! We hope you learn about disabled PHP functions through this article.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Disabled PHP Functions We have disabled PHP features to improve safety on our shared hosting servers: \u2013 exec\u2013 passthru\u2013 shell_exec\u2013 system\u2013 proc_open\u2013 popen\u2013 curl_exec\u2013 curl_multi_exec\u2013 parse_ini_file\u2013 show_source Please create a php.ini file in your public_html directory if you want to use the above PHP features on your website and add below line: \u201cdisable_functions =\u201d (without [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","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":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"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-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-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-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-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-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-gradient":""}}},"kbtopic":[113],"kbtag":[106],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23209"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=23209"}],"version-history":[{"count":8,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23209\/revisions"}],"predecessor-version":[{"id":37050,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23209\/revisions\/37050"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=23209"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=23209"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=23209"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=23209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}