nanoninja / docker-nginx-php-mysql

Docker running Nginx, PHP-FPM, MySQL & PHPMyAdmin
1.76k stars 867 forks source link

Add in WordPress #23

Open senrabdet opened 6 years ago

senrabdet commented 6 years ago

Great post/repository, fantastic instructions. Am hoping to request adding Wordpress into the mix as a docker container if that's of interest to others (am trying, initially am getting port conflicts and suspect that is the tip of the iceberg). Thx for giving it "a think".

nanoninja commented 6 years ago

That's a good idea to automated Wordpress installation. Send us a link when you got the project done.

zanematthew commented 6 years ago

@senrabdet @nanoninja wouldn't this be outside of the scope of the project? Adding WordPress is as easy as adding your WP code to web/ directory.

I'm currently using this with a Laravel project, and wouldn't expect this to be specific to a particular open source platform.

@senrabdet also its WordPress

nanoninja commented 6 years ago

@senrabdet, @zanematthew,

No indeed I do not think add it to this project either but I realize that what often changes is the organization depending on the type of project as (Laravel, Symfony, Wordpress).

I was thinking about developing a CLI tool based on project creation and that could be adapted to different types of applications more easily with less configuration. (Like Yeoman)

I'll see that when I have some time.

zanematthew commented 6 years ago

One idea might be to have a command that generates the web/ contents dynamically based on project; just quickly thinking here;

user enters a command, command prompts user for archive of web root (be it wordpress core.zip) process unpacks the contents (or downloads from remote URL) prompts user for nginx config etc... and can dynamically build the contents of the web root, without having the source files in the repo.

nanoninja commented 6 years ago

@zanematthew,

Yes I think it's a good idea for the future. This will make it more flexible and less dependent on the particular application type.

it would be a good evolution to put in place.

drm-code commented 6 years ago

captura de pantalla de 2018-06-12 09-48-14

I'm getting this error when I try to install a wordpress. I copied wordpress code to /web directory, installation starts well but when I configure the mysql data it fails, it seems like mysql is not running but phpmyadmin works like charm.

Any ideas??

I tried localhost localhost:8989 localhost:3306

drm-code commented 6 years ago

After multiple tries, I did docker inspect mysql which returns a huge json, then I looked for NetworkSettings.Networks.docker-nginx-php-mysql_default.IPAddress key and set that IP in wordpress settings page, voala!!! it works try that if you have the same issue.

al-mighty commented 6 years ago

@drm-code работает с hostname mysql try

<?php try { $dsn = 'mysql:host=mysql;dbname=broadcastdemo;charset=utf8;port=3306'; $pdo = new PDO($dsn, 'root', 'root'); foreach($pdo->query('SELECT * from wpkv_users') as $row) { print_r($row); } var_dump(json_encode($pdo)); } catch (PDOException $e) { echo $e->getMessage(); } ?>

ypinedaVS commented 6 years ago

Hi @devVyacheslav thanks for your answer, what I noticed is that everytime you run the container which wrappers the wordpress mysql IP changes not randomly but could change for example 198.128.0.3 to 198.128.0.4 and maybe 198.128.0.5 and it keeps some kind of pattern, what I just did everytime is test an IP from a set of them :)