7

I have VPS server (CentOS 6.5) running Apache 2.2.4 and PHP-FPM (FastCGI Process Manager). Looking in php-fpm error_log I've noticed error with every spawn php-fpm child process:

WARNING: [pool www] child 24086 said into stderr: "ERROR: Unable to set php_value 'soap.wsdl_cache_dir'"

I couldn't find any info on this warning googling. Is anybody aware what does this mean and how to get rid of this warning?

UPDATE 1:

fastcgi.conf for apache:

User apache                                                                                                                             
Group apache                                                                                                                            

LoadModule fastcgi_module modules/mod_fastcgi.so                                                                                        

<IfModule mod_fastcgi.c>                                                                                                                
    DirectoryIndex index.php index.html index.shtml index.cgi                                                                       
    AddHandler php5-fcgi .php                                                                                                       
    # For monitoring status with e.g. Munin                                                                                         
    <LocationMatch "/(ping|status)">                                                                                                
            SetHandler php5-fcgi-virt                                                                                               
            Action php5-fcgi-virt /php5-fcgi virtual                                                                                
    </LocationMatch>                                                                                                                

    Action php5-fcgi /php5-fcgi                                                                                                     
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi                                                                                     
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization                          
</IfModule>

# global FastCgiConfig can be overridden by FastCgiServer options in vhost config                                                       
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1

And here is the php-fpm.conf and pool configuration for php:

pid = /var/run/php-fpm/php-fpm.pid
daemonize = yes

; Start a new pool named 'www'.                                                                                                         
[www]

listen = /tmp/php5-fpm.sock 
group = apache
pm = dynamic
pm.max_children = 8
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.status_path = /status
ping.path = /ping
catch_workers_output = yes
php_admin_value[error_log] = /var/log/php-fpm/www-error.log                                                                             
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files                                                                                                 
php_value[session.save_path]    = /var/lib/php/session                                                                                  
php_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache

Everything else is on defaults.

UPDATE 2:

After manually creating /var/lib/php/wsdlcache directory as suggested and setting permissions to 770 and owner to root:apache, I hoped that I won't see the error again, but unfortunately after restarting php-fpm process the error is there again and this becomes something really very strange.

P.S. Maybe this question is more appropriate for serverfault, but generally there are more experts in php and apache configuration on stackoverflow.

Community
  • 1
  • 1
Arman P.
  • 4,314
  • 2
  • 29
  • 47
  • Mind to provide the appropriate part of your pool configuration?ALso, this is not really on-topic here, but rather on ServerFault or SuperUser. – Johannes H. Feb 06 '14 at 01:40
  • 1
    @JohannesH. I've updated the question with configuration files and my findings, but I have no enough expertise and practice with php-fpm to understand and solve the problem by myself. – Arman P. Feb 06 '14 at 04:24
  • hm. that config file does look fine to me. I don't see any reason why a higher idle timeout should change anything here either, as the error occurs on startup. Only tihng I can think of: does the directory /var/lib/php/wsdlcache exist? If FPM is running chrooted, make sure it does exist (and is accessible) inside the jail, too! – Johannes H. Feb 06 '14 at 04:32
  • 1
    @JohannesH. Yeah, I was thinking the same when updating question. I have created wsdlcache just now manually and set right permissions and owners. I think I won't see the error again. Can you please move your comment to answer, so that I will be able to mark it as a solution. Also `--idle-timeout` part was for the following thread: http://stackoverflow.com/questions/21594090/fastcgi-aborted-select-failed, I've accidently written it here :) – Arman P. Feb 06 '14 at 04:40
  • @JohannesH. Also why fpm can't create the directory itself? Isn't the session directory created by fpm or apache the same way? – Arman P. Feb 06 '14 at 04:41
  • I'm pretty sure the session directory, if placed in /var/lib/php, has to exist, too. That PHP-Pool is running with the access rights of user `apache`, which most likely doesn'T have write permissions in /var/lib. Sure, the main process could create it, but the effect of running children with limited rights and doing nothing but starting and chrooting them in the master process would be cancelled. And yes, wirting an answer right now ;) – Johannes H. Feb 06 '14 at 04:44

3 Answers3

26

I hate so trivial solutions. Finally I've found the problem and solution by myself. Leaving it here for reference for others with some pre-history.

FastCGI configuration files were taken from internet when first configuring FastCGI as I haven't used it before. Tutorials showing FastCGI configuration contained the line php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache. I became really interested what is SOAP as I don't use it on the websites that I run on this server and this curiosity brought me the solution. Actually I don't need SOAP and simply removing that line would fix the problem I guess, but I've decided to leave it there and found out that I needed simply to install php-soap.

yum install php-soap

For RHEL/CentOS

After restarting php-fpm I don't get the error on respawning fpm processes.

Arman P.
  • 4,314
  • 2
  • 29
  • 47
  • Note that while this package exists on Ubuntu, the soap extension is installed with just the default php5 package (Ubuntu 12.04). – Johannes H. Feb 06 '14 at 05:15
3

You're getting that message if the directory /var/lib/php/wsdlcache specified in your pool configuration doesn't exist and cannot created by the PHP worker either. Note that the PHP worker is not running as root, but as user apache (which is great for security and should be kept that way!), therefore it most likely doesn't have write permissions in /var/lib. Kepp also in mind that workers can be chrooted (your config doesn't look like you're doing it, but one can) - in that case, the directory has, of course, be inside the chroot jail.

Create that directory and modifiy the access rights so that apacheis able to read and write into it and everything should be fine.

Johannes H.
  • 5,875
  • 1
  • 20
  • 40
  • I still hope that I did something wrong with permission part. Yes the apache user had no write permission on `/var/lib/php` folder, but I get the same error even after manually creating it. See my Update 2 in question. Thanks – Arman P. Feb 06 '14 at 04:49
  • Hm. Permissions look ok. – Johannes H. Feb 06 '14 at 04:54
  • Yeah, they do unfortunately :) – Arman P. Feb 06 '14 at 04:57
  • My bet is Selinux is the culprit. Try turning it off real quick just to test. – ficuscr Feb 06 '14 at 04:58
  • @ficuscr Selinux is off on my server from the first day. I hate to debug problems caused by Selinux misconfiguration. – Arman P. Feb 06 '14 at 05:01
  • @ArmanP. Funny thing is: I just added that value to a new pool on my own server. And while that directory does NOT exist on my server, I still don't get any error... – Johannes H. Feb 06 '14 at 05:06
  • (it wasn't even created, I guess I'd get runtime errors when using SOAP, but PHP started up fine) – Johannes H. Feb 06 '14 at 05:08
  • 1
    @JohannesH. I know the reason, am writing the answer just now. Check whether you have `php-soap` installed? – Arman P. Feb 06 '14 at 05:09
  • I have it installed, and I checked the value in php.ini, it was applied correctly. So... you didn't have the extension installed/enabled? That'd explain it, yes ;) – Johannes H. Feb 06 '14 at 05:14
  • @JohannesH. I always hate so trivial solutions. Anyway, thank you very much for your help. Q&A with you helped to get to this point. – Arman P. Feb 06 '14 at 05:17
  • NP, glad I could help. – Johannes H. Feb 06 '14 at 05:18
0

Pretty sure you can't use php_value with (fast) CGI. You might want to look at user.ini files if using a version of PHP newer than 5.3.0 and needing PHP_INI_PERDIR ini settings.

Since PHP 5.3.0, PHP includes support for configuration INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.

UPDATE: Didn't see it was pool www. As Johannes H. observes: "You can use php_value inside the pool-cofiguration of php-fpm...". My original answer only really applies for per directory tweaks. See Johannes comment below.

ficuscr
  • 6,975
  • 2
  • 32
  • 52
  • 1
    You **can** use php_value inside the pool-cofiguration of php-fpm (not in apache though, that's correct). See http://www.php.net/manual/en/install.fpm.configuration.php This enales you to use different settings for each pool of PHP processes (user.ini files are per directory, not per pool, php.-ini is global for all pools inside php-fpm) – Johannes H. Feb 06 '14 at 02:08
  • Thanks Johannes. Your comment is more of an answer. Think overall still a useful Q&A for here - with your amendment. – ficuscr Feb 06 '14 at 02:35
  • Well, it doesn't answer the question, so it's not ;) But I agree, your answer in additoin with that comment serves a purpose here and shouldn't be deleted, even if it doesn't solve the problem in question. – Johannes H. Feb 06 '14 at 02:38
  • Thanks for your answer. I'm using `php 5.5.8` and it's allowed to change php_value inside pool-configuration, where it is done. – Arman P. Feb 06 '14 at 04:26