Report this

What is the reason for this report?

Permission denied to PHP.ini

Posted on January 5, 2016

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?



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!

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.

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.

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.

Type:

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 : )

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.