Record Install PHP develop environment on Arch Linux
sudo pacman -S php php-fpm php-gd nginx
make the folder under the ~
mkdir Projects
edit the file /etc/php/php-fpm.d/www.conf
user = x
group = x
listen = 127.0.0.1:9000
edit the file /etc/nginx/nginx.conf
change the two part:
#user http;
#change the user to access
server {
location / {
# root dir
root /home/x/Projects;
# ...
index index.html index.htm index.php;
}
}
# ...
location ~ \.php$ {
root html;
# root /home/x/Projects;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /home/x/Projects$fastcgi_script_name;
include fastcgi_params;
}
sudo systemctl restart nginx
sudo systemctl start php-fpm
#test
echo "<?php phpinfo();" >> ~/Projects/phpinfo.php
open the page http://localhost/phpinfo.php