Dies ist mein erstes Mal, dass ich versuche, Docker zu verwenden. Ich versuche, ein PHP -Projekt einzurichten, das die MySQLI -PHP -Erweiterung verwendet, aber aus irgendeinem Grund ist es nicht installiert, wenn ich meinen Docker -Container erstelle. Ich habe Php -m jedes Mal, wenn ein Wiederaufbau eine Liste aller Erweiterungen angezeigt, und MySQLI noch nie in dieser Liste angezeigt.
# Use the official PHP with Apache image
FROM php:8.1-apache
# Install mysqli extension
RUN docker-php-ext-install mysqli
# Enable mysqli extension
RUN docker-php-ext-enable mysqli
# Copy the source code and other necessary files into the container
COPY src/ /var/www/src/ # Copy the src folder to /var/www/src/
COPY public/ /var/www/html/ # Copy the public folder to /var/www/html (web server document root)/
COPY vendor/ /var/www/vendor/ # Copy the vendor folder to /var/www/vendor (Composer dependencies)/
# Set the proper permissions for Apache to access the files
RUN chown -R www-data:www-data /var/www/html /var/www/src /var/www/vendor \
&& chmod -R 755 /var/www/html /var/www/src /var/www/vendor
# Set the working directory
WORKDIR /var/www/html
# Expose port 80 for web traffic
EXPOSE 80
< /code>
docker-compose.yml:
version: '3.8'
services:
php-apache:
image: php:8.1-apache
container_name: wishlist-php-app
ports:
- "8082:80" # Map container port 80 to local 8080
volumes:
- ./public:/var/www/html # Maps your public folder to the container's document root
- ./src:/var/www/src # If you have source code outside the public folder
- ./vendor:/var/www/vendor # Map the vendor folder
environment:
- MYSQL_HOST=host.docker.internal # Connects to MySQL on your local machine (if running outside Docker)
- MYSQL_PORT=3306
# Optional: Use existing phpMyAdmin instance
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
ports:
- "8083:80" # Access phpMyAdmin at http://localhost:8081
environment:
PMA_HOST: host.docker.internal # Connects to MySQL on local machine
MYSQL_ROOT_PASSWORD: root # Replace with your root password
depends_on:
- php-apache
Dies ist mein erstes Mal, dass ich versuche, Docker zu verwenden. Ich versuche, ein PHP -Projekt einzurichten, das die MySQLI -PHP -Erweiterung verwendet, aber aus irgendeinem Grund ist es nicht installiert, wenn ich meinen Docker -Container erstelle. Ich habe Php -m jedes Mal, wenn ein Wiederaufbau eine Liste aller Erweiterungen angezeigt, und MySQLI noch nie in dieser Liste angezeigt.[code]# Use the official PHP with Apache image FROM php:8.1-apache
# Install mysqli extension RUN docker-php-ext-install mysqli
# Enable mysqli extension RUN docker-php-ext-enable mysqli
# Copy the source code and other necessary files into the container COPY src/ /var/www/src/ # Copy the src folder to /var/www/src/ COPY public/ /var/www/html/ # Copy the public folder to /var/www/html (web server document root)/ COPY vendor/ /var/www/vendor/ # Copy the vendor folder to /var/www/vendor (Composer dependencies)/
# Set the proper permissions for Apache to access the files RUN chown -R www-data:www-data /var/www/html /var/www/src /var/www/vendor \ && chmod -R 755 /var/www/html /var/www/src /var/www/vendor
# Set the working directory WORKDIR /var/www/html
# Expose port 80 for web traffic EXPOSE 80 < /code> docker-compose.yml: version: '3.8'
services: php-apache: image: php:8.1-apache container_name: wishlist-php-app ports: - "8082:80" # Map container port 80 to local 8080 volumes: - ./public:/var/www/html # Maps your public folder to the container's document root - ./src:/var/www/src # If you have source code outside the public folder - ./vendor:/var/www/vendor # Map the vendor folder environment: - MYSQL_HOST=host.docker.internal # Connects to MySQL on your local machine (if running outside Docker) - MYSQL_PORT=3306
# Optional: Use existing phpMyAdmin instance phpmyadmin: image: phpmyadmin/phpmyadmin container_name: phpmyadmin ports: - "8083:80" # Access phpMyAdmin at http://localhost:8081 environment: PMA_HOST: host.docker.internal # Connects to MySQL on local machine MYSQL_ROOT_PASSWORD: root # Replace with your root password depends_on: - php-apache [/code]
Ich bin ein Anfänger, ich habe diesen Fehler bekommen. Ich versuche, ihn viele Male zu beheben, aber ich bin nicht erfolgreich. PrettyPrint-Override > PS...
Ich bin ein Anfänger, ich habe diesen Fehler bekommen. Ich versuche, ihn viele Male zu beheben, aber ich bin nicht erfolgreich. PrettyPrint-Override > PS...
Ich habe eine Kivy -Anwendung, die in Android 11 gut installiert und funktioniert, aber ich kann sie nicht auf Android 14 installieren. Ich bekomme immer wieder Package Installer bleibt immer wieder...
Ich versuche, Projektabhängigkeiten mit Composer in einem Docker-Container basierend auf dem php:8.3-fpm-alpine-Image zu installieren. Dieses Bild enthält PHP mit mehreren Erweiterungen, die...
Ich habe ein neues Laravel 8-Projekt erstellt, das mit Laravel Sail, einer vorkonfigurierten Docker-Umgebung, geliefert wird. Es funktioniert gut, bis ich eine PHP-Erweiterung verwenden muss.
Die...