How to install php in docker httpd container
Get the solution ↓↓↓I'm trying to install php in a docker container.
I'm using docker httpd image. I know that their are images that include apache and php together, but i need to install php seperately.
I haven't found any documentation on how to do this. Note that i'm not using dockerfile.
If anyone could guide me through the steps or provide me some documentation on how to achieve this I would greatly appreciate it! Thanks!
PS. I have already got my apache server up and running, i have configured everything, only missing the php part so if this could be done without restarting it would be great!
Answer
Solution:
To install PHP just createDockerfile
with this content:
FROM php:<version>
Example:
FROM php:7.4
And in docker-compose.yml write:
php:
build: ./docker/php/
volumes:
- ".:/app"
Then build project with composer and thats it.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: a non-numeric value encountered
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.