Support / KnowledgeBase

 
Search the KnowledgeBase Search

How can I turn off safe_mode on an (dv) Dedicated-Virtual Server with Plesk?

  • Applies to: (dv) Nitro, All (dv)

  • Difficulty: Medium

  • Time needed: 10 minutes

  • Tools needed: SSH

 
  • Applies to: (dv) 4.0
    • Difficulty: Medium
    • Time: 10
    • Tools needed: SSH
  • Applies to: (dv) 3.5
    • Difficulty: Easy
    • Time: 10
    • Tools needed: SSH
  • Applies to: (dv) 3.0
    • Difficulty: Easy
    • Time: 10
    • Tools needed: SSH

For a discussion of Safe Mode and security, please see PHP Safe Mode, problems and work-arounds first.

Disable Safe Mode globally in SSH

You can edit your php.ini file to disable Safe Mode for all domains:

  1. Log into your server as a root or sudo user via SSH.
  2. Open your php.ini file for editing:
    vi /etc/php.ini
  3. Edit this line:

    Filename: php.ini

    safe_mode = On

    To this:

    Filename: php.ini

    safe_mode = Off

    vi tip:

    Type "/" and a search string, then hit enter to search for a particular phrase in a long file. Press "i" to enter "insert mode" so you can type and copy/paste. Press "Esc" to exit "insert mode" when you are done modifying the file. Type ":wq" to save and quit.

  4. Restart Apache:
    /etc/init.d/httpd restart

One-liner alternate method

  1. Log into your server as a root or sudo user via SSH.
  2. Execute the following command:
    perl -p -i -e 's/^safe_mode\s*=\s*on/safe_mode =off/i;' /etc/php.ini
  3. Restart Apache:
    /etc/init.d/httpd restart

Disable Safe Mode for individual domains in Plesk

  1. Sign into Plesk.
  2. Click on the Domains tab on the left.

    Plesk_domains.png

  3. Click on the domain you want to edit.
  4. Click on Setup under the Hosting section.

    Plesk_domain_setup.png

  5. Under Services, select PHP support and deselect PHP 'safe_mode.'

    Plesk_domain_setup_safe.png

  6. Click OK.

Test

You can verify that safe mode is off on your phpinfo.php page.


User Comments

No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article
Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue