Created
July 19, 2012 23:59
-
-
Save holms/3147755 to your computer and use it in GitHub Desktop.
Mysql, Php-fpm, Nginx, mysql-pdo, pear on OSX Mountain Lion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo port -v install mysql5-server | |
# Don't do any post-install instructions | |
sudo -u _mysql mysql_install_db5 | |
# if above command produce this error: ERROR: 1004 Can't create file '/var/tmp/#sqle967_1_0.frm' (errno: 9) | |
# do this: | |
# sudo chown -R mysql:mysql /opt/local/var/db/mysql5 | |
# sudo chmod u+rwx,go= /opt/local/var/db/mysql5 | |
# sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql | |
#edit php54 port | |
cd $(port dir php) | |
sudo cp Portfile Portfile.bak | |
sudo vim Portfile | |
# add this stuff: | |
# * Add --with-pdo-mysql \ | |
# * Add --with-sqlite \ # if you need sqlite don't forget to this port | |
# * Add --with-pdo-sqlite \ | |
# * Add --with-mysql=/opt/local/bin/mysql5 \ | |
# * Add --with-mysql-sock=/opt/local/var/run/mysql5/mysqld.sock \ | |
sudo port -v install php54-mysql +debug | |
sudo port -v install php54-gd +debug | |
sudo port -v install php54-mbstring +debug | |
sudo port -v install php54-iconv +debug | |
sudo port -v install php54-curl +debug | |
sudo port -v install php54-zip +debug | |
sudo port -v install php54-soap +debug | |
sudo port -v install php54-intl +debug | |
sudo port -v install php54-xmlrpc +debug | |
sudo port -v install php54-openssl +debug | |
# Install pear | |
sudo port -v install pear-install-phar | |
cd /opt/local/lib/php/pear/ | |
sudo php install-pear-nozlib.phar | |
sudo pear upgrade | |
sudo pear config-set auto_discover 1 | |
# Install doctrine | |
sudo pear channel-discover pear.doctrine-project.org | |
sudo pear install doctrine/Doctrine doctrine/DoctrineCommon doctrine/DoctrineDBAL doctrine/DoctrineORM doctrine/DoctrineSymfonyConsole doctrine/DoctrineSymfonyYaml | |
sudo port -v install php54-fpm +debug | |
sudo cp /opt/local/etc/php54/php.ini-development /opt/local/etc/php54/php.ini | |
sudo nano /opt/local/etc/php54/php-fpm.conf | |
-------------------------------------------- | |
[global] | |
pid = /var/run/php-fpm.pid | |
error_log = /var/log/php-fpm.log | |
daemonize = yes | |
[www] | |
listen = 127.0.0.1:9000 | |
listen.owner = holms | |
listen.group = staff | |
user = holms | |
group = staff | |
pm = static | |
pm.max_children = 1 | |
pm.start_servers = 1 | |
pm.min_spare_servers = 1 | |
pm.max_spare_servers = 1 | |
pm.max_requests = 500 | |
slowlog = /var/log/php-fpm.log.slow | |
env[HOSTNAME] = $HOSTNAME | |
env[TMP] = /tmp | |
env[TMPDIR] = /tmp | |
env[TEMP] = /tmp | |
sudo port -v install nginx +ssl | |
sudo cp /opt/local/etc/nginx/mime.types.example /opt/local/etc/nginx/mime.types | |
sudo cp /opt/local/etc/nginx/fastcgi_params.example /opt/local/etc/nginx/fastcgi_params | |
sudo nano /opt/local/etc/nginx/nginx.conf | |
------------------------------------ | |
user holms staff; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
root /Users/holms/Sites/your_web; | |
sendfile on; | |
keepalive_timeout 65; | |
server { | |
listen 80; | |
server_name local.pagalbadaiktais.lt | |
index index.php; | |
try_files $uri $uri/ /index.php; | |
location = /favicon.ico { | |
log_not_found off; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
try_files $uri =404; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
} | |
mkdir -p ~/Sites/site/web | |
sudo mkdir -p /var/log/nginx/ | |
cat > ~/Sites/site/web/index.php | |
<?php phpinfo(); ?> | |
ctrl+d | |
# put "127.0.0.1 local.site.nl" to /etc/hosts | |
cat >> ~/.profile | |
# nginx | |
alias nginx_start='sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist' | |
alias nginx_stop='sudo launchctl unload -w /Library/LaunchDaemons/org.macports.nginx.plist' | |
alias nginx_restart='nginx_stop; nginx_start;' | |
# php-fpm | |
alias fpm_start='sudo launchctl load -w /Library/LaunchDaemons/org.macports.php54-fpm.plist' | |
alias fpm_stop='sudo launchctl unload -w /Library/LaunchDaemons/org.macports.php54-fpm.plist' | |
alias fpm_restart='fpm_stop; fpm_start' | |
# mysql | |
alias sql_start="sudo /opt/local/share/mysql5/mysql/mysql.server start" | |
alias sql_stop="sudo /opt/local/share/mysql5/mysql/mysql.server stop" | |
alias sql_restart="sql_stop; sql_start" | |
ctrl+d | |
# If you using php53 so you'll have this bug: | |
# sudo nano /Library/LaunchDaemons/org.macports.php53-fpm.plist | |
# replace /opt/local/sbin/php-fpm53 to /opt/local/sbin/php-fpm53.dSYM | |
# https://trac.macports.org/ticket/35258 | |
sql_start | |
sudo /opt/local/lib/mysql5/bin/mysql_secure_installation | |
fpm_start | |
nginx_start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment