How does the php image docker run external PHP scripts?

< H2 > description < / H2 >

normal if PHP, is installed on the system, if you want to run a php script directly, php a.php can see the result.

how do I execute an a.php script if I use a docker build image?

Feb.28,2021

first do a directory mapping, map the directory where a.php is located to the inside of the container, and then execute it with cli inside the container


ssh-l loginname host-P port php a.php

for example, it is native. The port number is 8000 , and the user name is admin

.
ssh -l admin localhost -P 8000 a.php

docker run-- rm-it-v / (directory where a.php is located): / tmp php-docker (your docker image) sh-c "php / tmp/a.php"

-- rm single run container

if your php container is already running, exec it internally, or
docker exec-it container ID sh-c "php / (your mount directory) / a.php"


docker has a VOLUME that mounts the host directory, which you can set up.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36fef-2c070.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36fef-2c070.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?