Permalink
Browse files

Use real homebrew prefix. Closes #371

  • Loading branch information...
1 parent 4ebeb12 commit 0ab6f806097f42de2f13a7968101bfeca6093d33 @josegonzalez josegonzalez committed Nov 15, 2012
Showing with 13 additions and 11 deletions.
  1. +3 −3 Contributions/Using FPM.md
  2. +5 −5 Formula/abstract-php.rb
  3. +5 −3 README.md
@@ -85,7 +85,7 @@ Refer to https://github.com/josegonzalez/homebrew-php. You will need to add --wi
## Configuring PHP-FPM
-PHP-FPM's configuration file is located at /usr/local/etc/php/5.4/php-fpm.conf. The default configuration is fine for most purposes, but you may want to edit it to suit your needs. For example, some parameters you may want to tune are `pm.start_servers` (number of child processes at startup), `pm.max_spare_servers` (maximum number of idle server processes), `pm.max_requests` (maximum number of requests each child process should execute before respawning), etc…
+PHP-FPM's configuration file is located at $HOMEBREW_PREFIX/etc/php/5.4/php-fpm.conf. The default configuration is fine for most purposes, but you may want to edit it to suit your needs. For example, some parameters you may want to tune are `pm.start_servers` (number of child processes at startup), `pm.max_spare_servers` (maximum number of idle server processes), `pm.max_requests` (maximum number of requests each child process should execute before respawning), etc…
If you want PHP-FPM to listen on a Unix socket instead of a TCP socket (see the virtual host configuration below), which is faster when the web server and PHP-FPM are on the same machine, you must change `listen = 127.0.0.1:9000` to `listen = /tmp/php-fpm.sock` in php-fpm.conf.
@@ -94,7 +94,7 @@ If you want PHP-FPM to listen on a Unix socket instead of a TCP socket (see the
You may check that PHP-FPM is configured correctly by running the following:
```
- php-fpm -y /usr/local/etc/php/5.4/php-fpm.conf -t
+ php-fpm -y $HOMEBREW_PREFIX/etc/php/5.4/php-fpm.conf -t
```
You are now ready to make your first virtual host using PHP-FPM! Create an Apache virtual host configuration file in /etc/apache2/vhosts (or wherever your virtual host configuration files should be located), whose content will be similar to the following:
@@ -153,7 +153,7 @@ Do not forget to add the virtual host to /etc/hosts. Edit /etc/hosts and add the
Start php-fpm directly from the command line (for debugging):
```
- php-fpm --fpm-config /usr/local/etc/php/5.4/php-fpm.conf
+ php-fpm --fpm-config $HOMEBREW_PREFIX/etc/php/5.4/php-fpm.conf
```
Then restart Apache to enable the virtual host. Keep an eye on the Apache error log through the Console app to ensure that there are no errors. Then visit http://HOSTNAME/info.php. If all is fine, you should see a page of information about PHP. In the “Server API” field, you should read “FPM/FastCGI”.
View
@@ -248,9 +248,9 @@ def _install
if build.include? 'with-libmysql'
args << "--with-mysql-sock=/tmp/mysql.sock"
- args << "--with-mysqli=/usr/local/bin/mysql_config"
- args << "--with-mysql=/usr/local"
- args << "--with-pdo-mysql=/usr/local"
+ args << "--with-mysqli=#{$HOMEBREW_PREFIX}/bin/mysql_config"
+ args << "--with-mysql=#{$HOMEBREW_PREFIX}"
+ args << "--with-pdo-mysql=#{$HOMEBREW_PREFIX}"
end
if build.include?('with-mysql') || build.include?('with-mariadb')
@@ -385,9 +385,9 @@ def caveats
if MacOS.version >= :mountain_lion
s << <<-EOS.undent
- Mountain Lion comes with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:
+ Mountain Lion comes with php-fpm pre-installed, to ensure you are using the brew version you need to make sure #{$HOMEBREW_PREFIX}/sbin is before /usr/sbin in your PATH:
- PATH="/usr/local/sbin:$PATH"
+ PATH="#{$HOMEBREW_PREFIX}/sbin:$PATH"
EOS
end
View
@@ -95,13 +95,15 @@ If using Apache, you will need to update the `LoadModule` call. For convenience,
# /etc/apache2/httpd.conf
# Swapping from PHP53 to PHP54
- # LoadModule php5_module /usr/local/Cellar/php53/5.3.15/libexec/apache2/libphp5.so
- LoadModule php5_module /usr/local/Cellar/php54/5.4.5/libexec/apache2/libphp5.so
+ # $HOMEBREW_PREFIX is normally `/usr/local`
+ # LoadModule php5_module $HOMEBREW_PREFIX/Cellar/php53/5.3.15/libexec/apache2/libphp5.so
+ LoadModule php5_module $HOMEBREW_PREFIX/Cellar/php54/5.4.5/libexec/apache2/libphp5.so
If using FPM, you will need to unload the `plist` controlling php, or manually stop the daemon, via your command line:
# Swapping from PHP53 to PHP54
- cp /usr/local/Cellar/php54/5.4.5/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/
+ # $HOMEBREW_PREFIX is normally `/usr/local`
+ cp $HOMEBREW_PREFIX/Cellar/php54/5.4.5/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/
launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist
launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist

0 comments on commit 0ab6f80

Please sign in to comment.