Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting some Markdown formatting #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,45 @@ For PHP projects run through the command line interface (CLI), you can do the fo

### Create a `Dockerfile` in your PHP project

FROM louisbl/php:7.1-cli
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
CMD [ "php", "./your-script.php" ]
```
FROM louisbl/php:7.1-cli
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
CMD [ "php", "./your-script.php" ]
```

Then, run the commands to build and run the Docker image:

docker build -t my-php-app .
docker run -it --rm --name my-running-app my-php-app
```
docker build -t my-php-app .
docker run -it --rm --name my-running-app my-php-app
```

## With Apache

More commonly, you will probably want to run PHP in conjunction with Apache httpd. Conveniently, there's a version of the PHP container that's packaged with the Apache web server.

### Create a `Dockerfile` in your PHP project

FROM louisbl/php:7.1-apache
COPY src/ /var/www/html/
```
FROM louisbl/php:7.1-apache
COPY src/ /var/www/html/
```

Where `src/` is the directory containing all your php code. Then, run the commands to build and run the Docker image:

docker build -t my-php-app .
docker run -it --rm --name my-running-app my-php-app
```
docker build -t my-php-app .
docker run -it --rm --name my-running-app my-php-app
```

We recommend that you add a custom `php.ini` configuration. `COPY` it into `/usr/local/etc/php` by adding one more line to the Dockerfile above and running the same commands to build and run:

FROM louisbl/php:7.1-apache
COPY config/php.ini /usr/local/etc/php
COPY src/ /var/www/html/
```
FROM louisbl/php:7.1-apache
COPY config/php.ini /usr/local/etc/php
COPY src/ /var/www/html/
```

Where `src/` is the directory containing all your php code and `config/` contains your `php.ini` file.

Expand Down