I understand from your query that you need to orchestrate those two containers as services.
Since you want them to orchestrate over swarm cluster, you should use OVERLAY network.
Here is what you should try.
Create an overlay network first by using below commands:
docker network create -d overlay network_name
You can give your network name anything.Now your overlay network is created, you will have to orchestrate your containers as services over cluster using the created overlay network by using below commands:
docker service create --name mywebapp -d --network network_name -p 8001:80 phpimage_name
docker service create --name mysqlapp -d --network network_name -p 3306:3306 mysqlimage_name
Since, after using the above commands, you will be able to see the two services running as containers on your swarm cluster by using the below command i.e.,
docker ps
You can go inside the container and make the changes which are required by using below command i.e,
docker exec -it container_id bash
Now check the node on which php container is running and run that PHP application on the browser at port 8001. You will be able to access that php application.
I hope that it will resolve your query.