I compiled PHP 7.0.15 with php-fpm by adjusting my configure to this:
./configure --with-mysqli=mysqlnd --enable-ftp --with-openssl --with-zlib --with-gd --with-jpeg-dir=/usr/lib64 --disable-cli --enable-fpm
I then followed that a bit:
I did these commands:
-
sudo cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
-
sudo cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
-
vi /usr/local/etc/php-fpm.conf
I uncommented: pid = run/php-fpm.pid
And adjusted line 125 to: include=/usr/local/etc/php-fpm.d/*.conf
It seemed to still have issues with creating the log file so I did:
sudo touch /usr/local/var/log/php-fpm.log
Then I added php-fpm to run at start:
sudo echo ‘php-fpm’ >> /etc/rc.local
I confirmed it does run at next reboot with “ps aux”.
My caddy file is:
http://0.0.0.0:80 {
root /home/centos/www
fastcgi / 0.0.0.0:9000 php
errors error.log
}
I also tried this:
http://0.0.0.0:80 {
root /home/centos/www
fastcgi / 127.0.0.1:9000 php
errors error.log
}
html renders fine, but php files give “502 Bad Gateway”.
I tried other configs in my caddyfile, but the only other thing I got was “Not found” with this in error.log:
Primary script unknown
I tried looking for more info online, but didn’t find one that solves my issue yet.
Anyone have a tutorial or know how I could possibly make it work? I think I’m only missing something minor.
I’ll read these which I just found: