sprintcube / docker-compose-lamp Goto Github PK
View Code? Open in Web Editor NEWA basic LAMP stack environment built using Docker Compose.
License: MIT License
A basic LAMP stack environment built using Docker Compose.
License: MIT License
in which folder can I store my db-file.sql and then import it with the mysql shell?
shell> mysql db_name <db-file.sql
thanks
Hi, thank you for your compose. I just curious how to deploy into swarm service?
thanks
I tried to connect by default credentials root/tiger, but have this problem:
Cannot log in to the MySQL server
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
Hello,
I ran into an issue with the quick link urls that I think could be fixed quite easily. I was running this on a VM and when I pulled up the IP of the VM on a different machine on my network, the quick links did not work because the quick links use local host.
<li><a href="http://localhost/phpinfo.php">phpinfo()</a></li>
<li><a href="http://localhost:8080">phpMyAdmin</a></li>
<li><a href="http://localhost/test_db.php">Test DB Connection</a></li>
I feel like this could easily be resolved by changing the links as follows:
<li><a href="/phpinfo.php">phpinfo()</a></li>
<li><a href="//<?php print $_SERVER{'SERVER_NAME'}; ?>:8080">phpMyAdmin</a></li>
<li><a href="/test_db.php">Test DB Connection</a></li>
I would be happy to submit a PR if this is ok.
Thank you
This is the first time I ran docker composer, please let me know how to access php myadmin from browser?
Creating 5.7-mysql ... done
Creating sc-redis ... done
Creating 7.1.x-webserver ... done
Creating sc-phpmyadmin ... done
I can access http://localhost/ but not http://localhost/phpmyadmin.
Hello, thank you for share your project with us.
Im trying to configure virtual hosts, but im with problems. I created 2 directories site1 and site2 inside www directory each one with a index.html inside. After that I was in virtual host config file and configured 2 virtual hosts.
Finally I raised my containers and tried access to the hosts, but it doesn't work and if I type localhost, it still working.
There it is.
Hope you can help me.
Thank you.
Ricardo Silva
Hello, how could I install or activate mysql PDO connection in PHP.ini or docker-compose.yml?
mysqli_connect is not working on index.php
The index.php page is throwing error that MySQL connecttion failed: Connection refused
whereas test_db.php says Success: A proper connection to MySQL was made! The docker database is great. Host information: mysql via TCP/IP
Hi, I am a beginner in docker and I am having the following problem.
I can not connect to mysql using mysql_connect in the php file of index.php or test_db.php
try with the data in the file docker-compose.yml try to change the parameters but there is no case.
Hi
When I try to connect from PHP to the mysql database i get the following error
" Fatal error: Call to undefined function mysqli_connect() in /var/www/html/dbtest.php"
Thank you
-sasi
below are the steps to create a new virtual host.
Edit the file - docker-compose-lamp/config/vhosts/default.conf or Create a new configuration file at same path e.g. docker-compose-lamp/config/vhosts/myhost.conf
Enter the following virtual host code.
<VirtualHost *:80>
ServerAdmin webmaster@yourhostname
DocumentRoot "/var/www/html/your-dir"
ServerName yourhostname
<Directory "/var/www/html/your-dir/">
AllowOverride all
And save the file.
Change your ip if it is different.
I hope this helps.
I see you haven't create any data volumes to this, if you sremove the container is that data accessible again?
I pull repository, set my config, call docker-compose up -d
command, go to phpmyadmin and see error
The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click here.
Problem is
PMA Database ... not OK [ Documentation ]
General relation features Disabled
I googled and find what script phpmyadmin\sql\create_tables.sql
file from phpmyadmin directory must be launched to create pma database. I tried to launch from TTY of phpmyadmin container, but it dont have mysql installed.
I tried to import this file from phpmyadmin web-interface, but user "docker" dont have permission to do this.
I cant sign out and login as root because "exit" button dont work. (I immediately login as docker after sign out) ($cfg['Servers'][$i]['auth_type']
is cookie
, i checked).
And I cant connect to mysql server with HeidiSQL from host system with localhost:3306.
I want to create virtual host like: 127.0.0.1:8088 test.test
, but I can't. Please show me how.
It is the ip address problem or not ?
I download the branch 7.2 and docker-compose up it.
But, I cannot access database. Can't open PHPMyaadmin.
Everywhere I am getting the error:-
MySQL connecttion failed: Access denied for user 'root'@'172.28.0.3' (using password: YES)
Sorry, I dont know how to restart webserver.
For some weird reason, I can't run it on Fedora.
I can only access port 8080 and 6379, other ports are not available. After docker-compose up http://localhost gives me "Unable to connect"
Any idea how to fix this?
Forbidden
You don't have permission to access / on this server.
Server unable to read htaccess file, denying access to be safe
Apache/2.4.25 (Debian) Server at localhost Port 80
I test some php-apache image on Ubuntu18.04, All the same.
And test two "docker-compose.yml" on Ubuntu18.04, All the same too.
Hello,
I mounted the project a few mouths ago on my local laptop (ubuntu 18.04), it worked fine, few weeks later PHP was not working anymore so I decided to remove images and containers, to pull new project updates and to docker-compose again but the webserver image seems to be unfound.
ERROR: for a78144eb096d_7.3.x-webserver no such image: sha256:717fb604f35793d2e14926656008512fa8d23c2da72c56175aa1dfb5a7231539
Any help ? :)
Thank you !
Running this container, I can access the site via http://localhost
However, when I try to connect via https://localhost:443 the browser throws a:
This site can’t be reached
localhost unexpectedly closed the connection.
I tried adding some code to generate a self-signed certificate in the DockerFile and the following in /config/vhosts/default.conf, but nothing seems to work.
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerAlias localhost
DocumentRoot "/var/www/html"
ServerName localhost
<Directory "/var/www/html/">
AllowOverride all
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/generated.crt
SSLCertificateKeyFile /etc/ssl/private/generated.key
</VirtualHost>
Can you provide any pointers?
I have a problem with write permission on /var/www/html directory.
Warning: file_put_contents(aaa.txt): failed to open stream: Permission denied in /var/www/html/index.php on line 69
How can I fix it?
Hello, i'm new on docker, i installed a new laravel application under /var/www
cd my app
php artisan serve
when i go to 127.0.0.1:8000 i get proxy errror.
do you know why ?
can you ad a load blancer and reverse proxy with nginx?
Hi there,
I wanted to build a lamp docker with xdebug, but I haven't make it. And then I found your sharing. Thank you in advance.
When the script install XDebug, it failed:
error in 7.2.x
:
Step 6/27 : RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
---> Running in 1a589ab3686b
All settings correct for using Composer
Downloading...
Composer (version 1.7.3) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
Removing intermediate container 1a589ab3686b
---> d4dec3a0d39b
Step 7/27 : RUN pecl install xdebug-2.6.0
---> Running in 89bd995b2a4d
No releases available for package "pecl.php.net/xdebug"
install failed
ERROR: Service 'webserver' failed to build: The command '/bin/sh -c pecl install xdebug-2.6.0' returned a non-zero code: 1
error in 5.6.x
:
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
Installing header files: /usr/local/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
No releases available for package "pecl.php.net/xdebug"
install failed
ERROR: Service 'webserver' failed to build: The command '/bin/sh -c docker-php-ext-install curl && docker-php-ext-install tokenizer && docker-php-ext-install json && docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql && docker-php-ext-install pdo_sqlite && docker-php-ext-install mysqli && docker-php-ext-install zip && docker-php-ext-install -j$(nproc) intl && docker-php-ext-install mbstring && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd && pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini' returned a non-zero code: 1
Hello. Thank you for your dockerfile.
I have 1 problem and 1 question.
Problem: after docker-compose up files from local folder www (phpinfo.php, index.php) do not copy to var/www/html/. I tried open png-webserver container and didn't see these files.
Question: how can I import my SQL file automatically?
I have no privileges for the user docker. when i go to http://localhost:8080/ i'm logged directly without the auth step. i created containers with the default env config
how can i add other databases with all privileges?
thanks
any idea?
ARNING: The HOST_MACHINE_UNSECURE_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_SECURE_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The DATABASE variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_MYSQL_PORT variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_DATABASE variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_USER variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_REDIS_PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Port ranges don't match in length
services.webserver.ports is invalid: Port ranges don't match in length
services.redis.ports is invalid: Port ranges don't match in length
services.webserver.ports is invalid: Port ranges don't match in length
Hi,
I switch the Branch to 7.3.x version of PHP, but still get the 7.1.20 Version.
Hi how to including php files from parent subfolders. I must include ../src/bootstrap.php in index.php
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/html/www"
ServerName localhost
<Directory "/var/www/html/">
AllowOverride all
</Directory>
</VirtualHost>
volumes:
- ${DOCUMENT_ROOT-./www}:/var/www/html
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
- ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
Error:
Warning: require(/var/www/html/../src/bootstrap.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 10
Hello,
When i try to go inside the web server container docker-compose exec webserver bash
i get this error:
WARNING: The MYSQL_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_USER variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_UNSECURE_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_SECURE_HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_REDIS_PORT variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_DATABASE variable is not set. Defaulting to a blank string.
WARNING: The DATABASE variable is not set. Defaulting to a blank string.
WARNING: The HOST_MACHINE_MYSQL_PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file './../../docker-compose.yml' is invalid because:
services.mysql.ports is invalid: Port ranges don't match in length
services.webserver.ports is invalid: Port ranges don't match in length
services.redis.ports is invalid: Port ranges don't match in length
services.webserver.ports is invalid: Port ranges don't match in length
I m using Ubuntu.
thank you
hi, I have added the following command at the end of webserver dockerfile
RUN chown -R www-data:www-data /var/www/html
but the owner of /var/www/html/ is still root.
I am running docker on windows 10.
I have copied my application ( which is in laravel) under /var/www/html folder and the login page does come but after the post it gives 419 error. After some research, I figured out that owner of /var/www/html should be www-data. and I am not able to change the owner. please help.
log from apache AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu Apr 18 13:00:59.307872 2019] [core:warn] [pid 6] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Apr 18 13:00:59.311491 2019] [mpm_prefork:notice] [pid 6] AH00163: Apache/2.4.25 (Debian) PHP/7.1.20 configured -- resuming normal operations
[Thu Apr 18 13:00:59.312169 2019] [core:notice] [pid 6] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
and
<title>404 Not Found</title> Not Found The requested URL /svg/403.svg was not found on this server.Apache/2.4.25 (Debian) Server at www.localhost Port 80
is the error on browser.
Container does not start. I get the following output:
E: Package 'apt-utils' has no installation candidate
E: Unable to locate package nano
E: Unable to locate package wget
E: Package 'dialog' has no installation candidate
E: Package 'build-essential' has no installation candidate
E: Unable to locate package git
E: Unable to locate package libcurl3-dev
E: Unable to locate package zip
ERROR: Service 'webserver' failed to build: The command '/bin/sh -c apt-get -y install apt-utils nano wget dialog build-essential git curl libcurl3 libcurl3-dev zip' returned a non-zero code: 100
I have the following error message from the Apache server just after running the containers.
Once I connect in the browser to the localhost.
Forbidden
You don't have permission to access / on this server.
I have changed the permission and ownership of the /var/www/html folder within the container to www-data but the issue persists.
Do you have any workaround ?
Thank you for your help.
I'm having trouble connecting to the webserver on my Windows 10 pro version 1809 (build 17763.557). Following issue shows what's wrong:
`docker-compose-lamp [7.1.x ≡]> docker-compose up -d
Creating network "docker-compose-lamp_default" with the default driver
Creating sc-redis ... done
Creating 5.7-mysql ... done
Creating sc-phpmyadmin ...
Creating 7.1.x-webserver ... error
ERROR: for 7.1.x-webserver Cannot start service webserver: driver failed programming external connectivity on endpoint Creating sc-phpmyadmin ... done
for 0.0.0.0:80: unexpected error Permission denied
ERROR: for webserver Cannot start service webserver: driver failed programming external connectivity on endpoint 7.1.x-webserver (15705eb1029df55e86a8d6221ad2ddbf884e5f0712d1412482a3c0d9b11b9f08): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied
ERROR: Encountered errors while bringing up the project.
docker-compose-lamp [7.1.x ≡]>
`
Hello! I am new with Docker. Two moments:
Forbidden
You don't have permission to access / on this server.
Server unable to read htaccess file, denying access to be safe
How can i solve this problem
(By the way, phpMyAdmin (http://localhost:8080) works fine for me)
Thank you for sharing the docker compose lamp.
I tried to use Radis in my PHP code and I found there is no PHP extension for Radis in PHPInfo().
How can I access the Radis from my PHP code? Do I have to install the PHP extension for Radis or is there another way to access it?
Thank you for your help in advance.
I tried in several different ways to initialize the MySQL with *.sql script.
I tried to alter the Dockerfile or just alter the compose.yml, and, just not work...
What the correct way to initialize MySQL with a *.sql script in this project?
Thanks a lot.
When I run docker-compose up -d, the process eventually fails with the following error:
configure: error: unrecognized options: --with-freetype-dir, --with-jpeg-dir ERROR: Service 'webapp' failed to build: The command '/bin/sh -c apt-get -y update && apt-get --no-install-recommends install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && rm -rf /var/lib/apt/lists/* && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd' returned a non-zero code: 1
This appears to be related to the "# Install Freetype " section of the Dockerfile. When I comment out that portion of the dockerfile, the container runs.
I am not sure how to amend the Docker file to add the extension Imagick.
Can someone help with this issue?
best,
Andrei
I can't add any database from phpmyadmin.
Hi there,
Many thanks for your great docker compose lamp. I installed it successfully on Ubuntu 19, then I wanted to try an open source software. After I created my database, I used localhost as a database host name like when I installed LAMP locally but I got an error connection message.
I used mysql instead localhost for database host name and my problem was solved. I found this database host name from test_db.php file in www directory.
Have a lot of fun
Hi! I like to send you a pull request for a new branch with php 5.4 version.
In order to do the PR I would need you to create the new branch 5.4.x.
Thanks.
How can I reset the phpmyadmin password?
Hello,
Can't seem to get Wordpress to work with this stack. I can create a new database via phpmyadmin, but Wordpress cannot find the docker container db. I've tried modifying both the docker-compose.yml
file as well as the wp-config.php
.
docker-compose.yml
:
version: "3"
services:
webserver:
build:
context: ./bin/webserver
container_name: 'pcha-webserver'
restart: 'always'
ports:
- "80:80"
- "443:443"
links:
- mysql
volumes:
- ${DOCUMENT_ROOT-./www}:/var/www/html
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
- ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
mysql:
build: ./bin/mysql
container_name: 'pcha-mysql'
restart: 'always'
ports:
- "3306:3306"
volumes:
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: tiger
WORDPRESS_DB_USER: root
WORDPRESS_DB_NAME: pcha_local
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: 'pcha-phpmyadmin'
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- '8080:80'
volumes:
- /sessions
wp-config.php
: I've tried modifying the define('DB_HOST',
line to localhost:3306
as well (to match the port of the container).
define('DB_NAME', 'pcha_local');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'tiger');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
I have followed instruction in your readme and currently this is unmodified execution of docker-compose up. Everything goes fine untill it closes down at this point. I have made sure I stopped any host processes which could conflict with it like host version of httpd, nginx, php-fpm, mariadb. I am new to docker and this is one of my first attempts to have a docker development environment.
Creating png-mysql ... done
Creating png-phpmyadmin ... error
Creating png-webserver ... done
ERROR: for png-phpmyadmin Cannot start service phpmyadmin: driver failed programming external connectivity on endpoint png-phpmyadmin (194b54bcb060f91978f51200aad67a9d3e8fd5c149f16d44c4c5ab31078309a0): Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use
ERROR: for phpmyadmin Cannot start service phpmyadmin: driver failed programming external connectivity on endpoint png-phpmyadmin (194b54bcb060f91978f51200aad67a9d3e8fd5c149f16d44c4c5ab31078309a0): Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use
ERROR: Encountered errors while bringing up the project.
I am running fedora 29. I have used netstat -ltnp | grep -w ':80'
and netstat -ltnp | grep -w ':8080'
to ensure those ports are available along with default port of php-fpm and mariadb and memcached. All those ports are available.
sidenote: I actually needed this to run php5.6 so I was using that branch. But it installed php 7.2
Building webserver
Step 1/26 : FROM php:7.1.20-apache
Trying to pull repository docker.io/library/php ...
sha256:bc97986289c9397560aad8ee05ed572f88cd42d9df6aab5a0
I later realised that in the readme from 5.6 branch, you forgot to mentions that after doing git clone, I needed to checkout the 5.6 branch. You have mentioned it in the master branch to checkout 7.1 . So since I didn't checkout that branch, It was installing php 7.1 . It would be helpful if you could update that readme too.
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.