PHP-FPM will not work over TCP socket. No idea why

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:



upstream php 
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;


And changing the www.conf respectively.



; Start a new pool named 'www'.

[www]



; 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 address
on

; a specific port;

; 'port' - to listen on a TCP socket to all addresses on a

; specific port;

; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock

; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]


This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.



Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.



Any idea why this might be happening? What in centos is stopping me from access local sockets like this?










share|improve this question









New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • from/to which version you have updated the centos? did you check php config file? seafile config file?
    – malyy
    20 hours ago










  • I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
    – Joost Ziff
    20 hours ago










  • During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
    – malyy
    19 hours ago











  • Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
    – Joost Ziff
    19 hours ago










  • Try to disable SELinux (setenforce 0) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on etc.
    – Michael D.
    18 hours ago














up vote
0
down vote

favorite












I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:



upstream php 
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;


And changing the www.conf respectively.



; Start a new pool named 'www'.

[www]



; 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 address
on

; a specific port;

; 'port' - to listen on a TCP socket to all addresses on a

; specific port;

; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock

; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]


This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.



Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.



Any idea why this might be happening? What in centos is stopping me from access local sockets like this?










share|improve this question









New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • from/to which version you have updated the centos? did you check php config file? seafile config file?
    – malyy
    20 hours ago










  • I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
    – Joost Ziff
    20 hours ago










  • During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
    – malyy
    19 hours ago











  • Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
    – Joost Ziff
    19 hours ago










  • Try to disable SELinux (setenforce 0) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on etc.
    – Michael D.
    18 hours ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:



upstream php 
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;


And changing the www.conf respectively.



; Start a new pool named 'www'.

[www]



; 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 address
on

; a specific port;

; 'port' - to listen on a TCP socket to all addresses on a

; specific port;

; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock

; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]


This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.



Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.



Any idea why this might be happening? What in centos is stopping me from access local sockets like this?










share|improve this question









New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:



upstream php 
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;


And changing the www.conf respectively.



; Start a new pool named 'www'.

[www]



; 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 address
on

; a specific port;

; 'port' - to listen on a TCP socket to all addresses on a

; specific port;

; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock

; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1

; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]


This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.



Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.



Any idea why this might be happening? What in centos is stopping me from access local sockets like this?







centos php nginx






share|improve this question









New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 20 hours ago





















New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 22 hours ago









Joost Ziff

11




11




New contributor




Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Joost Ziff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • from/to which version you have updated the centos? did you check php config file? seafile config file?
    – malyy
    20 hours ago










  • I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
    – Joost Ziff
    20 hours ago










  • During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
    – malyy
    19 hours ago











  • Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
    – Joost Ziff
    19 hours ago










  • Try to disable SELinux (setenforce 0) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on etc.
    – Michael D.
    18 hours ago
















  • from/to which version you have updated the centos? did you check php config file? seafile config file?
    – malyy
    20 hours ago










  • I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
    – Joost Ziff
    20 hours ago










  • During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
    – malyy
    19 hours ago











  • Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
    – Joost Ziff
    19 hours ago










  • Try to disable SELinux (setenforce 0) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on etc.
    – Michael D.
    18 hours ago















from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago




from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago












I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago




I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago












During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago





During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago













Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago




Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago












Try to disable SELinux (setenforce 0) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on etc.
– Michael D.
18 hours ago




Try to disable SELinux (setenforce 0) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on etc.
– Michael D.
18 hours ago















active

oldest

votes











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481395%2fphp-fpm-will-not-work-over-tcp-socket-no-idea-why%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.












Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.











Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481395%2fphp-fpm-will-not-work-over-tcp-socket-no-idea-why%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay