New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #26039 (closed enhancement: fixed)

Opened 4 years ago

Last modified 19 months ago

php5: add fpm support

Reported by: info@… Owned by: ryandesign@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: jwa@…, 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

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

Change History

Changed 4 years ago by info@…

comment:1 Changed 4 years ago by jmr@…

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

Please remember to cc the maintainers.

comment:2 Changed 4 years ago by andy@…

  • Cc andy@… added

Cc Me!

comment:3 Changed 4 years ago by andy@…

  • Cc andy@… removed

Cc Me!

comment:4 Changed 4 years ago by andy@…

  • Cc andy@… added

Cc Me!

comment:5 Changed 4 years ago by bassliu@…

  • Cc bassliu@… added

Cc Me!

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

  • Cc cofyc.jackson@… added

Cc Me!

Changed 4 years ago by andy@…

updated patch

comment:7 Changed 4 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 4 years ago by andy@…

new necessary patchfile

Changed 4 years ago by andy@…

comment:8 Changed 4 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 4 years ago by chris@…

  • Cc chris@… added

Cc Me!

Changed 4 years ago by chris@…

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

Changed 3 years ago by ryandesign@…

slightly revised patch

comment:10 Changed 3 years ago by ryandesign@…

  • Summary changed from php5-5.3.3 Adding support to FPM to php5: 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 3 years ago by lewiszhang@…

  • Cc lewiszhang@… added

Cc Me!

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

  • Cc stefano+macports@… added

Cc Me!

comment:13 Changed 3 years ago by pjkixx@…

  • Cc pjkixx@… added

Cc Me!

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

  • Cc cofyc.jackson@… removed

Cc Me!

comment:15 Changed 3 years ago by ryandesign@…

  • Cc stipsan@… added

Has duplicate #29650.

comment:16 Changed 3 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 3 years ago by andreas@…

  • Cc andreas@… added

Cc Me!

comment:18 Changed 3 years ago by ryandesign@…

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 3 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 3 years ago by ryandesign@…

I have no immediate plans to work on this issue.

comment:21 Changed 3 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 3 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 3 years ago by rk@…

  • Cc rk@… added

Cc Me!

comment:24 Changed 3 years ago by foolswisdom@…

  • Cc foolswisdom@… added

Cc Me!

comment:25 Changed 3 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 3 years ago by John-Whitlock@…

  • Cc John-Whitlock@… added

Cc Me!

Changed 3 years ago by kipelovets@…

fpm-ryandesign updated to 5.3.8 port version

comment:27 Changed 3 years ago by kipelovets@…

  • Cc kipelovets@… added

Cc Me!

Changed 3 years ago by kipelovets@…

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

comment:28 Changed 3 years ago by ryandesign@…

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 3 years ago by ryandesign@…

  • 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 3 years ago by ryandesign@…

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

cd php54
sudo port install

comment:31 Changed 3 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 2 years ago by mitch@…

  • Cc mitch@… added

Cc Me!

comment:33 Changed 2 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 2 years ago by MailToArlo@…

comment:34 Changed 2 years ago by ryandesign@…

  • 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 2 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 2 years ago by andreas@…

  • Cc andreas@… removed

Cc Me!

comment:37 Changed 2 years ago by chad@…

  • Cc chad@… added

Cc Me!

comment:38 Changed 2 years ago by robsonpeixoto@…

  • Cc robsonpeixoto@… added

Cc Me!

comment:39 Changed 2 years ago by ryandesign@…

  • Status changed from new to closed
  • Resolution set to fixed

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

comment:40 Changed 19 months ago by ryandesign@…

Has duplicate #37475.

Note: See TracTickets for help on using tickets.