So far, this is still in the planning stages.
So far, this is still in the planning stages.
Sorry to hear it David. Was very much looking into finding a solution for this last week for a dedicated server that really needs it.
Tony Kammerer - Senior Admin, United Communications Ltd.
Proudly hosting over 50,000 customer websites since 1998!
Our lively customer community with over 70,000 posts!
We've been needing to use apc with php when using fastcgi & it appears that using php-fpm is the only way apc can share cache between processes. We definitely need this feature in cpanel. Please give this feature the priority it deserves!
More info on this:
PECL :: Request #11988 :: share cache between FAST CGI processes
I was able to get this working with the following steps:
1. Add the yum repos to grab php-fpm
Edit /etc/yum.conf to remove the php exclusion:
In the file you'll see something like the following:Code:vi /etc/yum.conf
Remove php* so that it looks like the following (please do not copy and paste these lines from the forum as I'm using quotes rather than code tags to make it easier to see without scrolling, simply remove php* from the line in the file):exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
Save the file (:wq). At that point, you would then install CentALT repo and grab php-fpm:exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
1. Add --with-fpm optionCode:yum --enablerepo=CentALT install php-fpm
2. Run EasyApache and select an MPM other than PreforkCode:echo "--with-fpm" >> /var/cpanel/easy/apache/rawopts/all_php5
In root SSH, run /scripts/easyapache or, in WHM, go to Software > EasyApache (Apache Update)
In Step 6 Exhaustive Options list, select MPM Worker
Of note, you are selecting an MPM other than Prefork as MPM Worker and MPM Event will not allow apxs to be built for PHP due to the fact DSO (mod_php) is disabled when using any MPM other than Prefork. This is the only way I know to build PHP without apxs and apxs being used is what prevents the --with-fpm option from working in PHP 5.3
Additionally, please note that you must be selecting PHP 5.3.3 or higher as your PHP 5 version. You cannot select anything lower and have the flag work.
After selecting that option, recompile Apache using "Save and build"
3. Copy the php-fpm.conf.default file so that you can load php-fpm
In that file, uncomment the following lines (you are welcome to revise the values as needed):Code:cd /usr/local/etc && cp php-fpm.conf.default php-fpm.conf
4. Start php-fpmCode:pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500
You will then see the processes running such as the following example:Code:php-fpm
Any other configuration settings you would like to set will be in that same /usr/local/etc/php-fpm.conf file. After revising it, please do the following to stop and restart it:Code:root@host [/]# ps aux | grep php-fpm root 27795 0.0 0.1 96780 3824 ? Ss 16:29 0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf) nobody 27796 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27797 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27798 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27799 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27800 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27801 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27802 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27803 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27804 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27805 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27806 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27807 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27808 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27809 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27810 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27811 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27812 0.0 0.1 96772 3672 ? S 16:29 0:00 php-fpm: pool www nobody 27813 0.0 0.1 96772 3676 ? S 16:29 0:00 php-fpm: pool www nobody 27814 0.0 0.1 96772 3676 ? S 16:29 0:00 php-fpm: pool www nobody 27815 0.0 0.1 96772 3676 ? S 16:29 0:00 php-fpm: pool www
Code:/etc/init.d/php-fpm stop php-fpm
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support
Submit a ticket | Check an existing ticket
Not working for me give me these erros.
Code:-- Begin opt 'MM' -- 'MM' requires the option 'MPM Worker' to be off or "skipped". !! Dependency failed for 'Cpanel::Easy::PHP5::MM' skipping option !!
Code:-- Begin step 'setting LDFLAGS env' -- -- End step 'setting LDFLAGS env' -- -- Begin step 'checking for prefork apache MPM' -- -- End step 'checking for prefork apache MPM' -- -- Begin step 'configuring php for apache and cli' -- !! ./configure --disable-cgi --disable-fileinfo --disable-phar --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zend-multibyte --enable-zip --prefix=/usr/local --with-bz2 --with-curl=/opt/curlssl/ --with-curlwrappers --with-fpm --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-tidy=/opt/tidy/ --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr
As you say i select MPM Worker in Exhaustive Options list also "--with-fpm" in rawopts, maybe is fpm-php?Code:Thank you for using PHP. Notice: Following unknown configure options were used: --with-fpm Check './configure --help' for available options -- End step 'configuring php for apache and cli' -- -- Begin step 'make php for apache and cli' --
No, it hasn't anything to do with php-fpm at all. It's an option not allowing you to select MPM Worker in place of Prefork. First of all, you don't have MPM Prefork also checked or some other MPM, correct? You cannot run two MPMs at the same time.
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support
Submit a ticket | Check an existing ticket
Actually, it appears to be this option in the PHP Exhaustive Options list:
If you have MM selected there, you cannot select MPM Worker apparently. If you cannot select MPM Worker or MPM Event, you won't be able to get this to work. You have the choice either to deselect MM in PHP's Exhaustive Options list or to not use php-fpmMM
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support
Submit a ticket | Check an existing ticket
deleted this.
Last edited by Kurogane; 08-17-2011 at 10:13 PM.
The MM is in the PHP Exhaustive Options list rather than the Apache ones. You'll have to uncheck MM in the PHP Exhaustive Options list. You cannot have both MM and MPM Worker it appears.
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support
Submit a ticket | Check an existing ticket
Yeah my bad, when i reply i notice that, read many times to understand that point now i can use MPM Worker but still give me this error
PHP 5.3.6
Code:Notice: Following unknown configure options were used: --with-fpm Check './configure --help' for available options -- End step 'configuring php for apache and cli' -- -- Begin step 'make php for apache and cli' --
Sorry I just noticed you posted PHP 5.3.6 as the version. I cannot tell you why you are getting that response when trying to use PHP 5.3.6 if you followed the guide. It did compile for me:
http://tristanwallace.com/index.php
It shows "with-fpm" on mine. I am off for the night, so I'll come back to this tomorrow to see if I can determine what isn't working out properly. I don't have time tonight to go further.
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support
Submit a ticket | Check an existing ticket
I'll check more deeper the issue so i compile manually
Lets see what --help give us.Code:root@localhost [/home/cpeasyapache/src/php-5.3.6]# ./configure --with-fpm Thank you for using PHP. Notice: Following unknown configure options were used: --with-fpm Check './configure --help' for available options
Directive --with-fpm not exist only --enable-fpm.Code:root@localhost [/home/cpeasyapache/src/php-5.3.6]# ./configure --help | grep fpm --enable-fpm EXPERIMENTAL: Enable building of the fpm SAPI executable --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody) --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this should usually be set to match the fpm username (default: nobody)
I have not tried yet with --enable-fpm but I will try tomorrow.
Last edited by Kurogane; 08-18-2011 at 03:15 AM.
Tristan you rock! This is great stuff, a few months back I played around with php-fpm via EA3 with no-luck. If I can recall from memory without doing googles, got a question on opcode cache...
We use Eaccelerator v0.961, but I remember that APC is needed for PHP-FPM for sharing of memory/procs?
I'm going to give this a shot tonight with APC.
Well all went through fine in EA3, only problem was the php-fpm init.d and .conf files were built in
/home/cpeasyapache/src/php-5.3.6/sapi/
So I guess EA3 didn't initialize php-fpm in the /usr/local/etc or in /sbin?
I copied the config over and had errors when trying to start fpm, after trying a few things... I kept getting sbin errors for line 57...
$php_fpm_BIN $php_opts
In the php-fpm.config should the pid line be set?
It was commented out.
Here's the init.d.php-fpm.config...
prefix=/usr/local
exec_prefix=${prefix}
php_fpm_BIN=${exec_prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid
The above was ran with the rawopts --with-fpm
Should I use --enable-fpm?
Also is mod_fcgid ok to use with php-fpm?
Or should I use mod_fastcgi and use a --enable-fastcgi config flag?
Kurogane, the directive "--with-fpm" does exist and should work as it did for me and boonjackmedia when we tried to use it. We would need to see your entire module list for PHP for me to see if I can reproduce what is happening for you to be unable to use that directive:
Additionally, please provide the output for the following:Code:php -m
I'm going to wipe my test machine and redo a setup using my above commands to see if there's something else I had in my environment that made it go more smoothly for me. I am suspecting it might be because, while trying to get this to work, I had removed the /etc/yum.conf exclusion for php and did "yum install php-fpm" at one point. The issue with that was I could never get PHP to detect that php-fpm existed. Since that didn't work, I then recompiled EasyApache afterward using that "--with-fpm" flag and set MPM Worker due to knowing apxs wouldn't be compiled (I learnt that when I was trying to get MPM ITK to work, since it requires mod_php or DSO PHP and it wouldn't compile due to apxs turning off for any MPM selected other than Prefork).Code:/usr/local/cpanel/bin/rebuild_phpconf --current
I'll post back once I've re-tested the steps on a clean setup.
cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
-- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support
Submit a ticket | Check an existing ticket