Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#26039 closed enhancement (fixed)

php5: add fpm support

Reported by: info@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: jyrkiwahlstedt, andy@…, bassliu@…, chris@…, lewiszhang@…, stefano+macports@…, pjkixx@…, stipsan@…, rk@…, foolswisdom@…, John-Whitlock@…, kipelovets@…, christopher.pesto@…, mitch@…, MailToArlo@…, chad@…, robsonpeixoto@…
Port: php5

Description

Hey

This diff file adds support to FPM with the fpm variant. It also registers a startup script for FPM.

One thing I couldn't manage to change is FPM default configuration file being installed to ${prefix}/etc/php-fpm.conf.default

Thanks. :)

Attachments (9)

php5-fpm-variant.diff (2.9 KB) - added by info@… 14 years ago.
php-fpm.diff (4.5 KB) - added by andy@… 14 years ago.
updated patch
patch-fpm-conf.diff (1.4 KB) - added by andy@… 14 years ago.
new necessary patchfile
php-fpm-v3.diff (4.4 KB) - added by andy@… 14 years ago.
patch-fpm-conf.2.diff (1.5 KB) - added by chris@… 14 years ago.
Updated patch-fpm-conf.diff. Original fpm.conf.in has changed.
fpm-ryandesign.diff (5.3 KB) - added by ryandesign (Ryan Carsten Schmidt) 14 years ago.
slightly revised patch
fpm-ryandesign_updated_5.3.8.diff (5.5 KB) - added by kipelovets@… 13 years ago.
fpm-ryandesign updated to 5.3.8 port version
php-fpm-conf.diff (543 bytes) - added by kipelovets@… 13 years ago.
php-fpm-conf.diff updated to port version 5.3.8
php5-fpm-subport-startup.diff (2.6 KB) - added by MailToArlo@… 13 years ago.

Download all attachments as: .zip

Change History (49)

Changed 14 years ago by info@…

Attachment: php5-fpm-variant.diff added

comment:1 Changed 14 years ago by jmroot (Joshua Root)

Cc: jwa@… added
Keywords: haspatch added; php5 fpm removed
Owner: changed from macports-tickets@… to ryandesign@…
Version: 1.9.1

Please remember to cc the maintainers.

comment:2 Changed 14 years ago by andy@…

Cc: andy@… added

Cc Me!

comment:3 Changed 14 years ago by andy@…

Cc: andy@… removed

Cc Me!

comment:4 Changed 14 years ago by andy@…

Cc: andy@… added

Cc Me!

comment:5 Changed 14 years ago by bassliu@…

Cc: bassliu@… added

Cc Me!

comment:6 Changed 14 years ago by cofyc.jackson@…

Cc: cofyc.jackson@… added

Cc Me!

Changed 14 years ago by andy@…

Attachment: php-fpm.diff added

updated patch

comment:7 Changed 14 years ago by andy@…

I've updated this patch and done some additional testing. It now supports using the +apache2 and +fpm variants simultaneously, (using the same double-compile strategy as the fastcgi variant). It also fixes the startupitem, and gives some info on initial configuration. I'll bug the IRC channel to have this merged.

Changed 14 years ago by andy@…

Attachment: patch-fpm-conf.diff added

new necessary patchfile

Changed 14 years ago by andy@…

Attachment: php-fpm-v3.diff added

comment:8 Changed 14 years ago by andy@…

Added a few fixes to the Portfile, as well as a necessary patch, which modifies php-fpm.conf to keep from daemonizing and to properly save a pid. Fixes issues where launchctl kept trying to start it.

comment:9 Changed 14 years ago by chris@…

Cc: chris@… added

Cc Me!

Changed 14 years ago by chris@…

Attachment: patch-fpm-conf.2.diff added

Updated patch-fpm-conf.diff. Original fpm.conf.in has changed.

Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: fpm-ryandesign.diff added

slightly revised patch

comment:10 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: php5-5.3.3 Adding support to FPMphp5: add fpm support

The attached doesn't work for all combinations of variants, for example:

sudo port install +fastcgi +fpm
--->  Computing dependencies for php5
--->  Fetching php5
--->  Verifying checksum(s) for php5
--->  Extracting php5
--->  Applying patches to php5
--->  Configuring php5
--->  Building php5
--->  Staging php5 into destroot
Error: Target org.macports.destroot returned: xinstall: Cannot stat: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_lang_php5/work/php-5.3.5/sapi/cgi/php-cgi, No such file or directory

The way the proposed patch handles the fpm config file is also not correct. The correct handling is how the port already handles the php.ini: it installs a sample configuration file, and advises the user where it is and that they should copy it if they want to use it.

I've attached a slightly updated patch which corrects the handling of the config file, and changes some of the comments to mirror those of the FastCGI sections.

I had wanted to wait on adding FPM support until I had separated each SAPI into its own port; see #19091. However Andy pointed out in his patch that PHP 5.4 will be able to properly build all SAPIs simultaneously. So maybe we keep all the SAPIs in one port after all, and just deal with the unpleasantness of multiple sequential builds until 5.4 is out. I fear there may need to be a drastic overhaul of how I do this, though, because I'm not happy with how each SAPI's options are basically specified twice in the portfile, and which version of the instructions is used depends on whether it is the only SAPI or not.

I noticed the patch copies php-fpm into ${prefix}/sbin, whereas the FastCGI binary is copied into ${prefix}/bin. I imagine they should both be in the same directory, though not certain which directory it should be. sbin seems like the correct choice, but that would mean users using fastcgi would need to change their setups. :/

comment:11 Changed 14 years ago by lewiszhang@…

Cc: lewiszhang@… added

Cc Me!

comment:12 Changed 14 years ago by stefano+macports@…

Cc: stefano+macports@… added

Cc Me!

comment:13 Changed 14 years ago by pjkixx@…

Cc: pjkixx@… added

Cc Me!

comment:14 Changed 14 years ago by cofyc.jackson@…

Cc: cofyc.jackson@… removed

Cc Me!

comment:15 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: stipsan@… added

Has duplicate #29650.

comment:16 Changed 13 years ago by andreas@…

Are we ever getting fpm in macports?

I think the way ubuntu does it is nice, thinking it would be cool with php5-fpm instead of php5 +fpm

comment:17 Changed 13 years ago by andreas@…

Cc: andreas@… added

Cc Me!

comment:18 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

I'm not familiar with how Ubuntu or other package managers do it, but what you've described sounds like what I planned to do; see #19091.

comment:19 Changed 13 years ago by andreas@…

Yeah something like that. I dont know how they do it either but they have php5-cgi , php5-cli, php5-fpm.

Are we not getting fpm before 5.4 or how does your plan look like ryan?

comment:20 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

I have no immediate plans to work on this issue.

comment:21 Changed 13 years ago by andy@…

FWIW, I gave up on maacports and have a great php-fpm setup running on homebrew. <http://mxcl.github.com/homebrew/>

comment:22 Changed 13 years ago by andreas@…

I know about brew. Just didnt have the engery to get my fingers into it yet since i never really had any problems with macports.

comment:23 Changed 13 years ago by rk@…

Cc: rk@… added

Cc Me!

comment:24 Changed 13 years ago by foolswisdom@…

Cc: foolswisdom@… added

Cc Me!

comment:25 Changed 13 years ago by foolswisdom@…

ryandesign thank you for maintaining so many essential ports!

I recently met the nginx developers and mentioned to them that I felt the lack of an official php fpm mac port is working against nginx adoption in PHP projects like the one I contribute to, WordPress.

Whether this approach or #19091 is there something that they can do to assist getting an official php fpm port? It seems like resolving the issues you describe in comment:10 would be essential to get this moving forward.

comment:26 Changed 13 years ago by John-Whitlock@…

Cc: John-Whitlock@… added

Cc Me!

Changed 13 years ago by kipelovets@…

fpm-ryandesign updated to 5.3.8 port version

comment:27 Changed 13 years ago by kipelovets@…

Cc: kipelovets@… added

Cc Me!

Changed 13 years ago by kipelovets@…

Attachment: php-fpm-conf.diff added

php-fpm-conf.diff updated to port version 5.3.8

comment:28 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

When using launchd, one does not want to daemonize.

I'm working on a major rewrite of the php ports which will change how php fpm will be done in MacPorts. So hang on.

comment:29 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: christopher.pesto@… added

I've been working on the afore-mentioned php port rewrite, currently underway in the new php54 port in my user directory of the repository. I just added the php54-fpm subport in r88174. It compiles for me. Can someone test whether it works, and/or let me know if the port should be printing some setup instructions? Should there be a startupitem?

Instructions for testing:

First time setup: Get the port definition:

svn checkout https://svn.macosforge.org/repository/macports/users/ryandesign/ports/lang/php54

For all of the below you need to be in the php54 directory, i.e. do this first:

cd php54

To later update the port definition:

svn update

To install the php fpm sapi:

sudo port install subport=php54-fpm

To see what got installed:

port contents php54-fpm

For now you have to deactivate your existing php ports first; I intend to correct this later.

comment:30 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

You will probably also need to install the main php54 port first with:

cd php54
sudo port install

comment:31 Changed 13 years ago by aziz.elezaby@…

ryan do you still need testers? I've got a virtual environment setup if that's still the case.

comment:32 Changed 13 years ago by mitch@…

Cc: mitch@… added

Cc Me!

comment:33 Changed 13 years ago by MailToArlo@…

I've successfully installed the fpm subport together with the apache2handler. I've had no issues on my local environment. In my opinion there should be some setup instructions as well as a StartupItem. I have created a patch containing these two additions.

Changed 13 years ago by MailToArlo@…

comment:34 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: MailToArlo@… added

I committed a different version of these changes in r89882. fpm seems to work. But the error log file is always empty, even if I load a PHP file with an error in it. Not sure if I've done something wrong there.

comment:35 Changed 13 years ago by MailToArlo@…

I could successfully install that revision.

Would a PHP error actually show up in the php-fpm logs? Shouldn't that show up in the file specified by php.ini's error_log directive?

But still php-fpm prints no logs. As far as I can see the problem is that with daemonize=no the logs are printed only to stdout/err. IMHO daemonize=yes should be used together with the wrapper shell script provided by php-fpm which I've used in my patch. For sudo load to work without an existing config the --with-fpm-pid http://php-fpm.org/wiki/Configuration_File compile option can be used.

comment:36 Changed 13 years ago by andreas@…

Cc: andreas@… removed

Cc Me!

comment:37 Changed 13 years ago by chad@…

Cc: chad@… added

Cc Me!

comment:38 Changed 13 years ago by robsonpeixoto@…

Cc: robsonpeixoto@… added

Cc Me!

comment:39 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

php53-fpm and php54-fpm have been in the ports tree for awhile. For any remaining issues please file new tickets.

comment:40 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Has duplicate #37475.

Note: See TracTickets for help on using tickets.