mikechernev / dockerised-php Goto Github PK
View Code? Open in Web Editor NEWDocker setup for PHP applications using PHP7-FPM and Nginx
Docker setup for PHP applications using PHP7-FPM and Nginx
I used your stack and modified code/index.php
like below:
<form method="post">
<input type="file" name="upload">
<input type="submit" name="submit" value="Submit">
</form>
<pre>
<?php
//phpinfo();
if (count($_FILES)) {
var_dump($_FILES);
} else {
echo "No file upload<br>";
}
var_dump($_SERVER['REQUEST_METHOD']);
?>
</pre>
And result after i choose a file and submit.
No file upload
string(4) "POST"
I am trying to use this to serve laravel app...pretty close to working but need help on a few tweaks:
I placed your repository in a folder named docker
within my root project folder. I mount the parent folder as a volume. Like so:
web:
image: nginx:latest
ports:
- "8089:80"
volumes:
- ../:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ../:/code
Then I modify site.conf
root to be /code/public
which has index.php
like so:
server {
index index.php index.html;
server_name php-docker.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /code/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
I am receiving a blank page when navigating to php-docker.local:8089
. I have verified the basic configuration is working before attempting to serve the laravel project.
I wanted to look at the access and error logs, but cat access.log
leads me to a black hole. ls- l gives me
`
lrwxrwxrwx 1 root root 11 Apr 5 18:53 access.log -> /dev/stdout
lrwxrwxrwx 1 root root 11 Apr 5 18:53 error.log -> /dev/stderr
`
which look like sym links.... was there a trick to get the nginx log I am forgetting? Anything else you see wrong?
Thanks for posting this, saw it in the docker email
Is possible add mysql to this docker-compose?
If the web
service is started before the php
service, You'll get an nginx error:
[emerg] 1:1: host not found in upstream "php" in /etc/nginx/conf.d/default.conf:12
Amending the config for web
like so will correct this problem:
web:
# ... other configs
depends_on:
- php
localhost:8080 is serving nginx welcome page instead of the index.php one, could you help me please ?
Not sure if this is issue related, but there appears to be a lack of understanding on how to allow sub folders to exist. What would be the recommendation from our site.conf file to allow any sub folder to exist and be accessible in the browser after we do our normal docker-compose up -d?
This is my sample code I'm working on based on a tutorial:
server {
index index.php index.html;
server_name php-docker.local;
error_log root /var/log/nginx/error.log;
access_log root /var/log/nginx/access.log;
root /phpweb;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Thanks for any direction
I added a simple .html file, but changing its content have no effect on the volume (I guess) I hit F5 on the browser and my changes doesm't shows up. I only can see my changes when I rename the project folder (I guess it creates a new volume).
This is really cool and I learned a lot but it seems the only pdo driver included is sqlite.
I need to access a postgres database on a remote machine with this. How do I add it? I have searched docker hub and every extension I can find is using mysql (ick).
Thanks for any tips.
I know this repo is quite old, but the code doesn't seem to work with the newest versions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.