pdsinterop / php-solid-server

Standalone Solid Server written in PHP by PDS Interop
https://pdsinterop.org/php-solid-server/
MIT License
46 stars 7 forks source link

First draft #1

Closed Potherca closed 4 years ago

Potherca commented 4 years ago

This MR adds some first-draft documentation and an empty PHP HTTP server (based on several popular PHP packages).

For all intents and purposes,this can be considered version 0.1.0.

michielbdejong commented 4 years ago

With the changes mentioned in https://github.com/potherca-contrib/solid-php/pull/1 I was able to start the Docker container. I didn't see anything on the host system:

loopy:php-solid-server michiel$ curl http://localhost/
curl: (7) Failed to connect to localhost port 80: Connection refused

Then I ran a shell inside the container so that I could see http://localhost/ on the inside, and this is the error I saw:

loopy:php-solid-server michiel$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
3c7f24138c92        php:7.1             "docker-php-entrypoi…"   3 seconds ago       Up 3 seconds                            interesting_lehmann
loopy:php-solid-server michiel$ docker exec -it 3c7f /bin/bash
root@docker-desktop:/# curl http://localhost/
<br />
<b>Warning</b>:  require(/app/web./../vendor/autoload.php): failed to open stream: No such file or directory in <b>/app/web/index.php</b> on line <b>5</b><br />
<br />
<b>Fatal error</b>:  require(): Failed opening required '/app/web./../vendor/autoload.php' (include_path='.:/usr/local/lib/php') in <b>/app/web/index.php</b> on line <b>5</b><br />
root@docker-desktop:/# 

Should I have run composer install --no-dev --prefer-dist on the host system before running the Docker container? If so, can't we do that in a build step of the Docker image?

EDIT: I also tried with the instructions based on the "composer" Docker image, but same result.

Potherca commented 4 years ago

Ugh. The culprit is /app/web./../vendor/autoload.php. This is a caused by a typo in require __DIR__ . './../vendor/autoload.php';. This should be fixed with my latest commit.

I've also merged you fix for docker 👍

Regarding composer install... I'm not entirely shure what the best way to go is. When I have sorted out a Dockerfile for this repo, it will indeed run composer install as one of the layers. Not entirely sure how/what to do with that in the docs for other solutions. I'll think about that a bit today and update the docs.

michielbdejong commented 4 years ago

With the composer Docker image, it's possible to run composer install inside the container, and then it will create the vendor folder (apparently running composer serve doesn't create the ../vendor folder?).

michielbdejong commented 4 years ago

Now, I was able to see 'hello world' :)