celsocelante / docker-lamp Goto Github PK
View Code? Open in Web Editor NEW(Linux) + Apache + MariaDB (MySQL) + PHP 7 on Docker.
(Linux) + Apache + MariaDB (MySQL) + PHP 7 on Docker.
I'm a total newbie to Docker and i don't know if the request is silly, but i would like to use as a "closed" environment for development.
Thanks!
Hi! Sorry my bad english. I'm a newbie to PHP and Docker. How can i setup my php.ini file? I don't know where is and how to modify it.
I've tried creating a Dockerfile for PHP that looks like this:
FROM php:7.2-apache
RUN docker-php-ext-install pdo_mysql
...and then adjusting the docker-compose.yml accordingly:
web:
build: .
But still I get 'connection refused'
Index file looks like:
try{
$db = new pdo('mysql:host=db:8889;dbname=database', 'root', 'root');
}catch(Exception $e){
echo $e -> getmessage();
}
tried both admin and root credentials specified in yml file. I've also tried 127.0.0.1 in place of db.
After quite a lot of hours of wondering how to go about using LAMP stack on Docker. I finally decided to use your docker-compose. I've also added the phpmyadmin as per another issue here. I've changed some ports to not run into errors.
My docker-compose looks like this -
web:
image: php:7.2-apache
environment:
- ALLOW_OVERRIDE=true
ports:
- "80:80"
links:
- db
volumes:
- ./app:/var/www/html/
db:
image: mariadb
restart: always
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: admin
MYSQL_PASSWORD: test
MYSQL_DATABASE: database
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
links:
- db
ports:
- 8888:80
environment:
MYSQL_USER: admin
MYSQL_PASSWORD: test
MYSQL_DATABASE: database
The problem I'm facing is this -
Warning: mysqli_connect(): (HY000/2002): Cannot assign requested address in /var/www/html/config.php on line 7
I tried using the container's IP Address using inspect, that didn't work either. I hope you can shed some light on what I might be doing wrong here.
the config.php file looks like this -
<?php
$host='localhost:8888';
$username="admin";
$password="";
$database="database";
$conn=mysqli_connect($host,$username,$password,$database);
?>
PS: I have changed(removed) the password from inside phpmyadmin
Hi,
I need to use RewriteEngine, but I can not goal. I am pretty new in Docker, so sorry if it is stupid question.
I have docker-compose.yml
only a bit edited:
version: '3.8'
services:
web:
container_name: c-web
image: php:7.4-apache
environment:
- ALLOW_OVERRIDE=true
ports:
- "80:80"
links:
- db
working_dir: /application
volumes:
- .:/application
- ./www:/var/www/html/
phpmyadmin:
container_name: c-phpmyadmin
image: phpmyadmin/phpmyadmin:latest
links:
- db
ports:
- 8081:80
environment:
MYSQL_USER: HOUser
MYSQL_PASSWORD: HOSokol12.
MYSQL_DATABASE: HO-Sokol
db:
container_name: c-mariadb
image: mariadb
restart: always
working_dir: /application
volumes:
- .:/application
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: toor
MYSQL_USER: HOUser
MYSQL_PASSWORD: HOSokol12.
MYSQL_DATABASE: HO-Sokol
ports:
- "3306:3306"
and I need to use this .htaccess
in www
(html root) directory
Require all granted
RewriteEngine On
# redirects hello/world to hello/world.html (if hello/world does not exists)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
But when Rewrite*
is present in .htaccess
, an error appears ๐
please, can you help me @celsocelante, @Keirodev or someone else?
I'm getting this error while using PDO
Fatal error: Uncaught PDOException: could not find driver in /var/www/html/
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.