Skip to content

Instantly share code, notes, and snippets.

@afair
Last active January 27, 2017 12:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afair/cc9436101ac24a699769 to your computer and use it in GitHub Desktop.
Save afair/cc9436101ac24a699769 to your computer and use it in GitHub Desktop.
Install PHP 5.3 on Apache 2.4 on OS X 10.10 Yosemite
#!/bin/sh
brew tap homebrew/dupes
brew install zlib
brew tap homebrew/php
brew install php53 --with-pgsql
# Troubleshooting...
#% php -v ~/src/guacamole
#dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.54.dylib
# Referenced from: /usr/local/bin/php
# Reason: image not found
# underlying library was upgraded. Reinstall PHP to point to new version of lib.
brew reinstall php53 -fs
################################################################################
# LOCAL CHANGES: Apache 2.4 + PHP
# Add this to bottom of your /etc/apache2/httpd.conf
################################################################################
User allen
Group staff
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so
AddHandler php5-script php
<Directory /Users/allen/www>
AllowOverride none
Require all granted
</Directory>
<VirtualHost *:80>
ServerName allen.allenfair.com
DocumentRoot /Users/allen/www
Options +EXECCGI -MultiViews
RewriteEngine On
RewriteRule ^/public/ - [L]
RewriteRule ^.+$ /index.php
ErrorLog /Users/allen/logs/apache/error_log
CustomLog /Users/allen/logs/apache/access_log common
</VirtualHost>
;################################################################################
; LOCAL CHANGES: PHP 5.3 Configuration
; Add to bottom of: /usr/local/etc/php/5.3/php.ini
; NOTE: Do NOT just copy these. Adjust to your own settings as needed.
; You may only just need "date.timezone"
;################################################################################
max_execution_time = 0
display_errors = Off
display_errors = On
log_errors = On
error_log = ../logs/apache/php_error_log
error_reporting = E_ALL & ~E_NOTICE
expose_php = Off
allow_call_time_pass_reference = On
pcre.backtrack_limit = 500000
pcre.recursion_limit = 500000
default_charset = "UTF-8"
date.timezone=America/New_York
register_globals = Off
register_long_arrays = Off
cgi.force_redirect = 0
extension=pdo.so
extension=iconv.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment