Php.ini editing

Hello Render community,

I’d like to know how to do I edit php.ini on a wordpress installation. I have added my key to ssh and I’m logged into ssh. even though apt-get works but Im not able to install nano or vi for editing php.ini.

And is there a possibility of installing PHP 8?

Thank you.

Hi there,

Thanks for reaching out.

PHP on Render requires it to be set up in Docker, so you have control over the environment to install whatever version of PHP and other packages you need.

Be aware that Render (as well as most cloud services) have an ephermal filesystem on running instances. Meaning that if you SSH into a running instance and change a file, that change will be lost the next time the service restarts (i.e. on the next deploy). You would want to edit and commit the php.ini in your codebase and redeploy.

Kind regards

Alan

1 Like

Thank you for replying @al_ps. I have installed wordpress on render using docker and would like to know how I can install an editor like Nano and upgrade latest PHP version.

till now I have connected with SSH and tried installing Nano using apt-get install Nano but it giving this

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

screenshot: Screenshot by Lightshot

As I mentioned before, installing other packages would need to be set up in Docker. As a step in your Dockerfile to install the editors you want.

However again, to reiterate, editing files on a running Render instance won’t be persisted. If you had nano installed and your instance running, editing the file on Render will not be saved when you next deploy. Your PHP config would also need to be part of the built Docker image.

Alan

@al_ps Thank you for helping out here. I come from a background where VPS or Hosting (occasional SSH to update and upgrade OS or installed interpreters) is used alongside FTP and files are uploaded and downloading and edited on the go.

Docker system is pretty much new to me. So what exactly is the solution to my problem? Shall I reinstall docker? if yes what do I do to install nano/php 8 and other stuff if I want it. :frowning: pardon my stupidity - new to all this.

Also is there any documentation I can read more on render dockers and understand how to do what I want?

We don’t have any documentation on the basics of Docker; you would need to find that information elsewhere, a quick Google should bring up a lot of resources. We do have some Docker project examples which may give you an idea of the ways Docker projects can be set up.

The Wordpress example, already has use of apt-get, which runs when the Docker image is being built from the Dockerfile. This is where you could install nano, but editing files on the instance may not work the way you expect, as mentioned above.

I’m not a PHP/Wordpress expert, but I expect you would need to add your php.ini to the repo and COPY it to the required path as part of the Docker build.

Official Wordpress Docker images are available on DockerHub. You could pick the tag of the version you want (which also encompasses the PHP version) and you’d update the FROM declaration of the Dockerfile.

A Render disk (shown in the example in the render.yaml) is added for files that need persistence between restarts/deploys. These files can be edited (this is where you would need nano) or transferred (Magic Wormhole may be simplest).

Alan

1 Like