Skip to content

Instantly share code, notes, and snippets.

@lgrz
Created May 21, 2012 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgrz/2760430 to your computer and use it in GitHub Desktop.
Save lgrz/2760430 to your computer and use it in GitHub Desktop.
php53 & php54 formula patch
diff --git a/Formula/php53.rb b/Formula/php53.rb
index 7adbbea..a456a1a 100644
--- a/Formula/php53.rb
+++ b/Formula/php53.rb
@@ -76,12 +76,16 @@ class Php53 < Formula
return p
end
+ def config_path
+ etc+"php/5.4"
+ end
+
def install
args = [
"--prefix=#{prefix}",
"--disable-debug",
- "--with-config-file-path=#{etc}",
- "--with-config-file-scan-dir=#{etc}/php5/conf.d",
+ "--with-config-file-path=#{config_path}",
+ "--with-config-file-scan-dir=#{config_path}/conf.d",
"--with-iconv-dir=/usr",
"--enable-dba",
"--with-ndbm=/usr",
@@ -208,12 +212,12 @@ class Php53 < Formula
ENV.deparallelize # parallel install fails on some systems
system "make install"
- etc.install "./php.ini-development" => "php.ini" unless File.exists? etc+"php.ini"
+ config_path.install "./php.ini-development" => "php.ini" unless File.exists? config_path+"php.ini"
chmod_R 0775, lib+"php"
- system bin+"pear", "config-set", "php_ini", etc+"php.ini" unless ARGV.include? '--without-pear'
- if ARGV.include?('--with-fpm') and not File.exists? etc+"php-fpm.conf"
- etc.install "sapi/fpm/php-fpm.conf"
- inreplace etc+"php-fpm.conf" do |s|
+ system bin+"pear", "config-set", "php_ini", config_path+"php.ini" unless ARGV.include? '--without-pear'
+ if ARGV.include?('--with-fpm') and not File.exists? config_path+"php-fpm.conf"
+ config_path.install "sapi/fpm/php-fpm.conf"
+ inreplace config_path+"php-fpm.conf" do |s|
s.sub!(/^;?daemonize\s*=.+$/,'daemonize = no')
s.sub!(/^;?pm\.max_children\s*=.+$/,'pm.max_children = 50')
s.sub!(/^;?pm\.start_servers\s*=.+$/,'pm.start_servers = 20')
@@ -232,7 +236,7 @@ To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module #{libexec}/apache2/libphp5.so
The php.ini file can be found in:
- #{etc}/php.ini
+ #{config_path}/php.ini
If you have installed the formula with --with-fpm, to launch php-fpm on startup:
* If this is your first install:
@@ -251,7 +255,7 @@ You may also need to edit the plist to use the correct "UserName".
def test
if ARGV.include?('--with-fpm')
- system "#{sbin}/php-fpm -y #{etc}/php-fpm.conf -t"
+ system "#{sbin}/php-fpm -y #{config_path}/php-fpm.conf -t"
end
end
@@ -268,7 +272,7 @@ You may also need to edit the plist to use the correct "UserName".
<array>
<string>#{sbin}/php-fpm</string>
<string>--fpm-config</string>
- <string>#{etc}/php-fpm.conf</string>
+ <string>#{config_path}/php-fpm.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
diff --git a/Formula/php54.rb b/Formula/php54.rb
index 675273f..2b85752 100644
--- a/Formula/php54.rb
+++ b/Formula/php54.rb
@@ -84,12 +84,16 @@ class Php54 < Formula
return p
end
+ def config_path
+ etc+"php/5.4"
+ end
+
def install
args = [
"--prefix=#{prefix}",
"--disable-debug",
- "--with-config-file-path=#{etc}",
- "--with-config-file-scan-dir=#{etc}/php5/conf.d",
+ "--with-config-file-path=#{config_path}",
+ "--with-config-file-scan-dir=#{config_path}/conf.d",
"--with-iconv-dir=/usr",
"--enable-dba",
"--with-ndbm=/usr",
@@ -217,12 +221,12 @@ class Php54 < Formula
ENV.deparallelize # parallel install fails on some systems
system "make install"
- etc.install "./php.ini-development" => "php.ini" unless File.exists? etc+"php.ini"
+ config_path.install "./php.ini-development" => "php.ini" unless File.exists? config_path+"php.ini"
chmod_R 0775, lib+"php"
- system bin+"pear", "config-set", "php_ini", etc+"php.ini" unless ARGV.include? '--without-pear'
- if ARGV.include?('--with-fpm') and not File.exists? etc+"php-fpm.conf"
- etc.install "sapi/fpm/php-fpm.conf"
- inreplace etc+"php-fpm.conf" do |s|
+ system bin+"pear", "config-set", "php_ini", config_path+"php.ini" unless ARGV.include? '--without-pear'
+ if ARGV.include?('--with-fpm') and not File.exists? config_path+"php-fpm.conf"
+ config_path.install "sapi/fpm/php-fpm.conf"
+ inreplace config_path+"php-fpm.conf" do |s|
s.sub!(/^;?daemonize\s*=.+$/,'daemonize = no')
s.sub!(/^;?pm\.max_children\s*=.+$/,'pm.max_children = 50')
s.sub!(/^;?pm\.start_servers\s*=.+$/,'pm.start_servers = 20')
@@ -241,7 +245,7 @@ To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module #{libexec}/apache2/libphp5.so
The php.ini file can be found in:
- #{etc}/php.ini
+ #{config_path}/php.ini
If you have installed the formula with --with-fpm, to launch php-fpm on startup:
* If this is your first install:
@@ -260,7 +264,7 @@ You may also need to edit the plist to use the correct "UserName".
def test
if ARGV.include?('--with-fpm')
- system "#{sbin}/php-fpm -y #{etc}/php-fpm.conf -t"
+ system "#{sbin}/php-fpm -y #{config_path}/php-fpm.conf -t"
end
end
@@ -277,7 +281,7 @@ You may also need to edit the plist to use the correct "UserName".
<array>
<string>#{sbin}/php-fpm</string>
<string>--fpm-config</string>
- <string>#{etc}/php-fpm.conf</string>
+ <string>#{config_path}/php-fpm.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment