{"id":978,"date":"2024-04-29T17:22:46","date_gmt":"2024-04-29T11:52:46","guid":{"rendered":"https:\/\/mirchihost.com\/blog\/?p=978"},"modified":"2024-04-29T17:22:51","modified_gmt":"2024-04-29T11:52:51","slug":"enable-php-functions","status":"publish","type":"post","link":"https:\/\/mirchihost.com\/blog\/enable-php-functions\/","title":{"rendered":"How to enable PHP functions on VPS Server?"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"how-to-enable-php-functions-on-vps-server\">How to enable PHP functions on VPS Server?<\/h1>\n\n\n\n<p>Enabling <a href=\"http:\/\/mirchihost.com\" data-type=\"link\" data-id=\"mirchihost.com\">PHP functions<\/a> on a VPS (Virtual Private Server) involves configuring your server&#8217;s PHP settings. Here are the general steps to do this:<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"access-your-vps\"><strong>Access Your VPS:<\/strong><\/h5>\n\n\n\n<p>Log in to your VPS using SSH or a control panel like cPanel, Plesk, or WHM.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"locate-php-configuration\"><strong>Locate PHP Configuration:<\/strong><\/h5>\n\n\n\n<ul>\n<li>The PHP configuration file is typically named <code>php.ini<\/code>. You can find it in different locations depending on your server setup:\n<ul>\n<li>For CentOS\/RHEL: <code>\/etc\/php.ini<\/code><\/li>\n\n\n\n<li>For Ubuntu\/Debian: <code>\/etc\/php\/{version}\/apache2\/php.ini<\/code> or <code>\/etc\/php\/{version}\/cli\/php.ini<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"edit-php-ini\"><strong>Edit php.ini:<\/strong><\/h5>\n\n\n\n<p>Use a text editor like nano or vim to open the <code>php.ini<\/code> file. For example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"845\" height=\"66\" src=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-14.png?resize=845%2C66&#038;ssl=1\" alt=\"\" class=\"wp-image-979\" srcset=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-14.png?w=845&amp;ssl=1 845w, https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-14.png?resize=300%2C23&amp;ssl=1 300w, https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-14.png?resize=768%2C60&amp;ssl=1 768w\" sizes=\"(max-width: 845px) 100vw, 845px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Replace <code>{version}<\/code> with your PHP version, such as 7.4 or 8.0.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"enable-php-functions\"><strong>Enable PHP Functions:<\/strong><\/h5>\n\n\n\n<ul>\n<li>Search for the section in <code>php.ini<\/code> related to disabling functions. This section typically contains lines like <code>disable_functions = ...<\/code>.<\/li>\n\n\n\n<li>If you want to enable a specific function (e.g., <code>exec<\/code>, <code>shell_exec<\/code>, <code>mail<\/code>), remove it from the <code>disable_functions<\/code> list. For example:<\/li>\n<\/ul>\n\n\n\n<p><code>disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source<\/code><\/p>\n\n\n\n<p>Change it to:<\/p>\n\n\n\n<p><code>disable_functions = passthru,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source<\/code><\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"save-changes\"><strong>Save Changes:<\/strong><\/h5>\n\n\n\n<p>After making the necessary changes, save the <code>php.ini<\/code> file and exit the text editor.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"restart-apache-nginx\"><strong>Restart Apache\/Nginx:<\/strong><\/h5>\n\n\n\n<p>Restart your web server (Apache or Nginx) for the changes to take effect. Use a command like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"56\" src=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-15.png?resize=730%2C56&#038;ssl=1\" alt=\"\" class=\"wp-image-980\" srcset=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-15.png?w=730&amp;ssl=1 730w, https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-15.png?resize=300%2C23&amp;ssl=1 300w\" sizes=\"(max-width: 730px) 100vw, 730px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Or for Nginx:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"628\" height=\"51\" src=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-16.png?resize=628%2C51&#038;ssl=1\" alt=\"\" class=\"wp-image-981\" srcset=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-16.png?w=628&amp;ssl=1 628w, https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-16.png?resize=300%2C24&amp;ssl=1 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"verify-changes\"><strong>Verify Changes:<\/strong><\/h5>\n\n\n\n<p>You can verify that the PHP functions are enabled by creating a simple PHP script that uses the functions you enabled. For example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"124\" src=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-17.png?resize=793%2C124&#038;ssl=1\" alt=\"\" class=\"wp-image-982\" srcset=\"https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-17.png?w=793&amp;ssl=1 793w, https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-17.png?resize=300%2C47&amp;ssl=1 300w, https:\/\/i0.wp.com\/mirchihost.com\/blog\/wp-content\/uploads\/2024\/04\/image-17.png?resize=768%2C120&amp;ssl=1 768w\" sizes=\"(max-width: 793px) 100vw, 793px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<ul>\n<li>Save this as <code>test.php<\/code> in your web server&#8217;s document root (<code>\/var\/www\/html\/<\/code> for Apache by default) and access it via your browser (<code>http:\/\/yourdomain\/test.php<\/code>). If it displays the directory listing, it means the <code>shell_exec<\/code> function is enabled.<\/li>\n<\/ul>\n\n\n\n<p>Always be cautious when enabling PHP functions, especially those related to system commands (<code>exec<\/code>, <code>shell_exec<\/code>) or file operations, as they can pose security risks if not used carefully.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#how-to-enable-php-functions-on-vps-server\">How to enable PHP functions on VPS Server?<\/a><ul><li><a href=\"#access-your-vps\">Access Your VPS:<\/a><\/li><li><a href=\"#locate-php-configuration\">Locate PHP Configuration:<\/a><\/li><li><a href=\"#edit-php-ini\">Edit php.ini:<\/a><\/li><li><a href=\"#enable-php-functions\">Enable PHP Functions:<\/a><\/li><li><a href=\"#save-changes\">Save Changes:<\/a><\/li><li><a href=\"#restart-apache-nginx\">Restart Apache\/Nginx:<\/a><\/li><li><a href=\"#verify-changes\">Verify Changes:<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<p><a href=\"https:\/\/www.servercake.blog\/author\/editor\/\" rel=\"nofollow noopener\" target=\"_blank\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to enable PHP functions on VPS Server? Enabling PHP functions on a VPS (Virtual Private Server) involves configuring your server&#8217;s PHP settings. Here are the general steps to do this: Access Your VPS: Log in to your VPS using SSH or a control panel like cPanel, Plesk, or WHM. Locate PHP Configuration: Edit php.ini: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"footnotes":"","_jetpack_memberships_contains_paid_content":false,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[33],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9N6ER-fM","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/posts\/978"}],"collection":[{"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/comments?post=978"}],"version-history":[{"count":2,"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/posts\/978\/revisions"}],"predecessor-version":[{"id":984,"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/posts\/978\/revisions\/984"}],"wp:attachment":[{"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/media?parent=978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/categories?post=978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mirchihost.com\/blog\/wp-json\/wp\/v2\/tags?post=978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}