Permission denied to PHP.ini

Hi. I want to update the uploadmaxfilesize in php.ini document but apparently i don’t have permission to edit this file. Is there anyone know how to get access to be able to modify this number?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I take it you have created a new user on initial setup and granted admin privileges to the new user? somewhere in line with this guide

If you have try this…

Login with created user credentials:

ssh username@ip address`

Once logged in type this:

sudo bash

Enter your password, this should then show you in control as root user (root@yourdropletname:~#) Next enter this:

nano /etc/ssh/sshd_config

Search for a section where it says “PermitRootLogin” and if set to ‘no’ change to ‘yes’

Press ‘Cntl+X’ to exit then ‘Y’ then ‘ENTER’ to save.


reload ssh

Now root (<—user) login through SFTP to change you php.ini file inside etc/php5/apache2/ to suit. Once this has been edited and saved go back to the nano /etc/ssh/sshd_config step and change back ‘PermitRootLogin’ to ‘no’ and remember to reload ssh again.

Finally use this command:

sudo service apache2 restart

Hopefully that should do it! Worked for me : )

System settings files, such as php.ini, typically require root level permissions to modify. Sometimes, settings files even require root to even read them, since they may contain login credentials for databases and such.

You’ll need to elevate to root, usually using the sudo command to execute your editor, and that will require you to enter your password the first time you do it within a configured session lifetime.

Or you could su to root, but typically, droplets don’t come configured with a root password, so password login to root won’t even work.