Kshitij2604 commited on
Commit
6a95647
·
verified ·
1 Parent(s): 41d8884

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +11 -11
  2. app.py +2 -2
  3. requirements.txt +1 -2
Dockerfile CHANGED
@@ -1,14 +1,14 @@
1
  FROM python:3.9-slim
2
 
3
- # Install PHP and PHP-FPM
4
  RUN apt-get update && apt-get install -y \
5
- php8.1-fpm \
6
- php8.1-mysql \
7
- php8.1-common \
8
- php8.1-mbstring \
9
- php8.1-xml \
10
- php8.1-zip \
11
- php8.1-curl \
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-FPM
25
- RUN echo "php_admin_flag[display_errors] = on" >> /etc/php/8.1/fpm/pool.d/www.conf \
26
- && echo "php_admin_value[error_reporting] = E_ALL" >> /etc/php/8.1/fpm/pool.d/www.conf
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-FPM
20
  result = subprocess.run(
21
- ['php-fpm', '-n', '-d', 'display_errors=1', '-d', 'error_reporting=E_ALL', 'index.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