php_archlinux


"/home/yossef/notes/notes-random/php_archlinux.md"

path: notes-random/php_archlinux.md

- **fileName**: php_archlinux
- **Created on**: 2025-03-08 00:15:18

how ot run php in archlinux using docker

first create a docker file

# Use an official PHP runtime as a parent image
FROM php:8.1-apache

# Set the working directory in the container
WORKDIR /var/www/html

# Copy the PHP file into the container's web directory
COPY index.php /var/www/html/

# Set the ServerName to suppress the warning about Apache's domain name
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf

# Enable mod_rewrite for Apache (optional, useful for many PHP applications)
RUN a2enmod rewrite

# Expose port 80 (the default HTTP port)
EXPOSE 80
docker build -t php-docker-example .
docker run -p 8090:80 php-docker-example
Important

second way and the easy way to run php

install some main packages

sudo pacman -S php
sudo pacman -S php-apache php-cgi php-fpm php-gd  \
    php-embed php-intl php-redis php-snmp

after this make a dir for exmpale ~/php_study and then create afile

with name index.php and run this commend

php -S localhost:4444
this gone run something like nodemon in js
Tip

for install a composer in archlinux sudo pacman -S composer

continue:./package_free_i_use.md
before:./firefox-shourtcuts.md