Editing PHP upload limits on a vps

Web Development

How to edit the php.ini file on a Unix based server using SSH.

It’s important to alter the php.ini file on any new server as most are set up for very generic use and can sometimes pose a security threat to your site. A classic but simple example of this is the “Show Errors” setting; having this active on a live site can give people serious insight into how your site works and, by forcing errors, can give away information you don’t want them to have.

This article does not go through all the security implications of the php.ini file but it does, however, cover how to make changes via the Unix shell – more specifically the Vi editor.

  1. Connect to your server via SSH.
  2. Locate your php.ini file (contact your hosts if you can’t find this).
  3. Navigate to the same directory as your php.ini file. To open the file for editing, type the following:

    vi php.ini

    This opens the PHP file in the Vi editor. Using the Vi editor can be pretty tricky so I’m just going to cover the basics when it comes to editing and saving the file. If you require a full step-by-step breakdown, please click here. Okay, so we have the file open and at the moment you are in “command” mode (this means you’re not actually editing anything)…
  4. Use the arrow keys to navigate around the document, in the current “command” mode you can freely move around the document without actually editing any of the content. We want to navigate down the document till we find a setting saying something like:

    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 32M

    Once you’ve located the setting, simply set the value to what you need.
  5. Save the file and restart your vps.

That’s it, job done!

Posted on by Pete
Tagged: 

Post a Message

Scribble your thoughts below to leave a comment and then just click send! Fields marked * are required. Your email address will not be published.

Trying to track something?

Simply type and click track!

Track.
  •  
Follow.

Design Store

Daily Culture

And Also...