centos7 上 yum 安裝 php 5.6
<code>vim /etc/php-fpm.d/www.conf </code>
修改
<code>;listen = 127.0.0.1:9000 listen=/dev/shm/php-fcgi.sock</code>
建立php-fcgi.sock
檔案
<code>touch listen=/dev/shm/php-fcgi.sock chmod 777 /dev/shm/php-fcgi.sock</code>
重啟php-fpm
<code>systemctl restart php-fpm</code>
但是/dev/shm/php-fcgi.sock
還是普通文件 ,不是socket文件,查看 log 沒報錯,如何解決?
centos7 上 yum 安裝 php 5.6
<code>vim /etc/php-fpm.d/www.conf </code>
修改
<code>;listen = 127.0.0.1:9000 listen=/dev/shm/php-fcgi.sock</code>
建立php-fcgi.sock
檔案
<code>touch listen=/dev/shm/php-fcgi.sock chmod 777 /dev/shm/php-fcgi.sock</code>
重啟php-fpm
<code>systemctl restart php-fpm</code>
但是/dev/shm/php-fcgi.sock
還是普通文件 ,不是socket文件,查看 log 沒報錯,如何解決?
刪除普通文件,以Unix Socket方式運行時,sock文件由php-fpm創建
設定檔不是寫了什麼,php-fpm會自己產生這個socket文件,並且被master進程所引用
<code>; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on ; a specific port; ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on ; a specific port; ; 'port' - to listen on a TCP socket to all IPv4 addresses on a ; specific port; ; '[::]:port' - to listen on a TCP socket to all addresses ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. </code>
我覺得是配置寫錯了。
php-fpm.conf
<code>listen = /dev/shm/php-fcgi.sock listen.owner = www listen.group = www listen.mode = 0660</code>
nginx.conf
<code>fastcgi_pass unix:/dev/shm/php-fcgi.sock;</code>