Wednesday, December 1, 2021

Run php page inside docker container using docker commands

 Run php page inside docker container using docker commands

===========================


docker run -tid -v /root/var/www/html:/var/www/html -p 8080:80 --name="phpserver" php:7.4-apache

(you have to upload a test.php file in /html location  and image is downloaded automatically if not available for php:7.4-apache)

docker ps

(above to get container id as container is created)

(gives file permisson -- but have to run everytime if you modify test.php or any other file in html folder) 

docker exec 20ea72577d44 chmod -R 755 /var/www/html


Run in url : http://[your local host address]/test.php

No comments: