PHP-FPM socket problems?

Discussion in 'Installation/Configuration' started by Kubek, May 22, 2014.

  1. Kubek

    Kubek New Member

    Hi, I am running few servers with Nginx, PHP-FPM and ISPConfig 3.0.5.4p1 mostly on Debian and Ubuntu.

    But I had some problems on one of my servers where all of my websites are almost identical(except some .php config files). What I can see is that I have wrong files executed by websites which they don't belong to. For example website web4 is showing some errors in my error log about .php files of web3. Also some informations from database which should be printed just by web3 are also printed by web4. This depends on which site I visit as first. This is what I tried so far:

    • spinned 2 new virtual servers with different OS(Ubuntu 14.04 and Debian 7) and different repositories
    • checked all configuration files (but have not touched any of them)
    • Checked if this is problem of APCu or ZendOpzimizer (problems were still there after I disabled both of them)

    So I am wondering if this has to do something with PHP-FPM sockets on which these sites are listening.

    Software I am using:

    • nginx 1.6.0
    • PHP-FPM 5.5.12 with APCu and ZendOptimizer enabled

    I really hope you can help me somehow and I hope you understand me.
     
  2. MaddinXx

    MaddinXx Member HowtoForge Supporter

    I had some problems with ZendOptimizer on shared environments. You might want to disable that one and try again.

    My problems were not related to yours, but it may be worth a try..
     
  3. Kubek

    Kubek New Member

    Thank you very much for your response but that didn't help. I have error 502 on the one of the sites ...

    No errors in nginx error log or in php-fpm log ... just some error in logs of one of the sites "upstream sent too big header while reading response header from upstream". But I fixed this right away. Still nothing really changed. Problems persists. Web2 is trying to access files of web1 and failing badly. If I access web1 as first than web1 is trying to include files of web2, etc. ...

    I really hope you can give me some another advice because I don't know what to do anymore.

    Thank you very much for your time again.
     
  4. ItsDom

    ItsDom New Member

  5. Kubek

    Kubek New Member

    First thank you very much for trying to answer my question.

    The problem is I have my PHP processes listening on sockets. I will switch back to listening on port and see if it solves the problems (even though it doesn't really solves it ... I would like them to listen on unix sockets for various reasons).

    Anyway I just tried it and same things are happening again. So what you have done is that you changed port in all of your configs to 9000? Right?
     
    Last edited: May 28, 2014
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The port has to be changed to the right port of the php-fpm instance of the website. Each website ahs its own php-fpm instance and eaxh of this instances has its own port. so if you use any custom nginx recipes that connect to the php-fpm server, then your code has to use the right port or your scripts will get executed under a wrong user and wont work as this wrong user has no permissions in the website.
     
  7. Kubek

    Kubek New Member

    They have right ports in their vhost configuration files. They are same as their ID in ISPConfig panel. Same if I am using sockets. Everything is correctly set up. But I still have these problems. I am not sure what I can try now. I think it is time to remove panel and do it with bare hands :)
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The panel is not the problem here as the same panelworks flawlessly on ten thousands of nginx servers worldwide and the panel just writes the config files and you siad yourself that they contain no faults. If you think that sockets are the problem here, then compare the sockets paths in the vhost files with the ones in the php fpm pools.
     
  9. Kubek

    Kubek New Member

    But the problem with the panel here is that they may be "doing things you don't know about" or don't need to know. Many things are there just working and I don't care about them. I don't really know how it is configured by ISPConfig and I don't have to. Because of that there can be problems like this which I can't solve if I don't see "deeper" to problems.

    Don't take it personally. ISPConfig is one of the best panels out there and that is why I chose it. Thank you very much for creating such a great product.

    Back to the problem.

    They are all configured properly ... that's why I don't know what to try to do now.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you use any binary caches in php or do you use memcache or any other caches that might be shared between your websites?
     
  11. Kubek

    Kubek New Member

    I am using just Zend Optimizer+ with default configuration as opcache and APCu as user data cache. I think we can say APCu is not doing any harm as my problems are beyond the data if I see wrong files included.
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    You should try to turn the caches off. ispconfig is not doing any "magic" in that setup, it just writes the fpm pool conf file and the nginx vhost file for a site. The other things are just to create directories. So if the pool conf an nginx vhost are correct, then the problem must be somewhere else, it is most likely something that has been added additionally to the default perfect setup as this setup is used on thousands of servers and your problem has not been reported by other users.
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    maybe one thing that you could chec if any symlinks point to a wrong site. The directories in /var/www/ with the domain name are symlinks to the real directories. maybe one of that points to a wrong target.
     
  14. Kubek

    Kubek New Member

    I checked symlinks and I think there are no problems with them.

    Changes I made to DigitialOcean VPS with Ubuntu 14.04 LTS in brief

    Code:
    dpkg-reconfigure tzdata
    
    service apparmor stop
    update-rc.d -f apparmor remove
    apt-get remove apparmor apparmor-utils
    
    add-apt-repository ppa:nginx/stable
    add-apt-repository ppa:ondrej/php5
    apt-get install software-properties-common
    apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
    add-apt-repository 'deb http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu trusty main'
    
    dpkg-reconfigure dash <--NO
    
    apt-get install openssl rkhunter binutils sudo
    apt-get install mariadb-server nginx-light
    apt-get install php5-fpm php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-sqlite php5-xmlrpc php5-xsl php5-apcu
    
    #HERE I SET FEW NOT REALLY IMPORTANT SETTINGS IN PHP.INI
    
    apt-get install quota quotatool
    nano /etc/fstab
    	pridať ",usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0" na partíciu / za "remount-ro"
    mount -o remount /
    quotacheck -avugm
    quotaon -avug
    
    apt-get install fail2ban postfix
    
    #THE INSTALLATION OF ISPCONFIG
    cd /tmp
    wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
    tar xfz ISPConfig-3-stable.tar.gz
    cd ispconfig3_install/install/
    php -q install.php
    	ENTER
    	mode: expert
    	mysql password
    	multiserver: n
    	mail: n
    	jailkit: n
    	ftp: n
    	dns: n
    	nginx: y
    	firewall: n
    	web_interface: y
    	port: 8880
    	ssl: y
    
    #Changes in default values of web_domain table
    stats_type = none
    pm_max_children = 7
    pm_start_servers = 1
    pm_start_servers = 1
    pm_max_spare_servers = 2
    backup_interval = daily
    
    #Slightly changed nginx vhost conf master to allow only execution of index.php
    	location /index.php {
                try_files <tmpl_var name='rnd_php_dummy_file'> @php;
            }
    
    #Few changes in nginx.conf
    	[...]
    	worker_processes  4;  # 2 * Number of CPUs
    	[...]
    	events {
    		worker_connections  1024;
    		multi_accept on;
    	}
    	[...]
    	http {
    		server_names_hash_bucket_size 128;
    		#uncomment gzip
    	}
    	[...]
    
    #Modifications of php-fpm pools settings
    /etc/php5/fpm/php-fpm.conf
    	[...]
    		process.max = 40 # RAM/25
    	[...]
    /etc/php5/fpm/pool.d/apps.conf
    	[...]
    	1
    	1
    	1
    	1
    	[...]
    /etc/php5/fpm/pool.d/ispconfig.conf
    	[...]
    	3
    	1
    	1
    	2
    	[...]
    /etc/php5/fpm/pool.d/ispconfig.conf
    	[...]
    	3
    	1
    	1
    	2
    	[...]
    
    The numbers in last "pool" settings are number of processes settings in following order:

    max_children
    start_servers
    min_spare
    max_spare

    Thank you very much for your help so far. I really appreciate it.
     

Share This Page