Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Dockerfile +11 -11
- app.py +2 -2
- requirements.txt +1 -2
Dockerfile
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Install PHP and
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
# Set working directory
|
|
@@ -21,9 +21,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 21 |
# Copy application files
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
-
# Configure PHP
|
| 25 |
-
RUN echo "
|
| 26 |
-
&& echo "
|
| 27 |
|
| 28 |
# Expose port
|
| 29 |
EXPOSE 7860
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
+
# Install PHP and required extensions
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
+
php \
|
| 6 |
+
php-mysql \
|
| 7 |
+
php-common \
|
| 8 |
+
php-mbstring \
|
| 9 |
+
php-xml \
|
| 10 |
+
php-zip \
|
| 11 |
+
php-curl \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
# Set working directory
|
|
|
|
| 21 |
# Copy application files
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
+
# Configure PHP
|
| 25 |
+
RUN echo "display_errors = On" >> /etc/php/7.4/cli/php.ini \
|
| 26 |
+
&& echo "error_reporting = E_ALL" >> /etc/php/7.4/cli/php.ini
|
| 27 |
|
| 28 |
# Expose port
|
| 29 |
EXPOSE 7860
|
app.py
CHANGED
|
@@ -16,9 +16,9 @@ def execute_php(php_file):
|
|
| 16 |
if os.path.exists(dir_name):
|
| 17 |
shutil.copytree(dir_name, os.path.join(temp_dir, dir_name))
|
| 18 |
|
| 19 |
-
# Execute PHP using PHP
|
| 20 |
result = subprocess.run(
|
| 21 |
-
['php
|
| 22 |
cwd=temp_dir,
|
| 23 |
capture_output=True,
|
| 24 |
text=True
|
|
|
|
| 16 |
if os.path.exists(dir_name):
|
| 17 |
shutil.copytree(dir_name, os.path.join(temp_dir, dir_name))
|
| 18 |
|
| 19 |
+
# Execute PHP using the system's PHP interpreter
|
| 20 |
result = subprocess.run(
|
| 21 |
+
['php', '-n', '-d', 'display_errors=1', '-d', 'error_reporting=E_ALL', 'index.php'],
|
| 22 |
cwd=temp_dir,
|
| 23 |
capture_output=True,
|
| 24 |
text=True
|
requirements.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
gradio==3.50.2
|
| 2 |
mysql-connector-python==8.0.26
|
| 3 |
-
python-dotenv==0.19.0
|
| 4 |
-
php-fpm==8.1.0
|
|
|
|
| 1 |
gradio==3.50.2
|
| 2 |
mysql-connector-python==8.0.26
|
| 3 |
+
python-dotenv==0.19.0
|
|
|