Skip to content

Instantly share code, notes, and snippets.

@Swop
Last active December 10, 2015 16:48
Show Gist options
  • Save Swop/4463124 to your computer and use it in GitHub Desktop.
Save Swop/4463124 to your computer and use it in GitHub Desktop.
Mac OSX PHP Tech stack for Symfony2 projects (Original Mac OS Apache, Compiled PHP & tools)
mkdir -p /usr/local/src
== XCode Command line tools
Installer XCode ou récuppérer depuis l'Apple Developper Center l'install unique des CommandLine Tools
== X11
http://xquartz.macosforge.org/
== HomeBrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
(voir http://mxcl.github.com/homebrew/)
== Installation de la libjpeg & PCRE
brew update
brew install libjpeg && brew install pcre
== Installation d'ICU
Download at http://site.icu-project.org/download
cd /usr/local/src
curl -L http://download.icu-project.org/files/icu4c/49.1.2/icu4c-49_1_2-src.tgz > icu4c-49_1_2-src.tgz
tar zxvf icu4c-49_1_2-src.tgz
cd icu/source
chmod +x runConfigureICU
./runConfigureICU MacOSX
make
sudo make install
== PHP
brew install automake
cd /usr/local/src
git clone https://github.com/php/php-src.git
cd php-src
git checkout php-5.4.9
./buildconf --force
./configure \
--prefix=/usr/local \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-icu-dir=/usr/local \
--with-iodbc=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--without-pear \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-pcre-regex \
--with-pgsql=/usr \
--with-pdo-pgsql=/usr \
--with-freetype-dir=/usr/X11 \
--with-png-dir=/usr/X11 \
--with-jpeg-dir=/usr \
--enable-intl
make && make install
Si non modifié automatiquement, activer PHP dans Apache (/etc/apache2/httpd.conf) :
LoadModule php5_module libexec/apache2/libphp5.so
== PHP sundown
cd /usr/local/src
git clone https://github.com/chobie/php-sundown.git php-sundown --recursive
cd php-sundown
phpize
./configure
make
make install
add extension=sundown.so in /etc/php.ini
apachectl restart
== APC
pecl install apc
SI MARCHE PAS AVEC PECL (mon cas) :
Récupérer apc : http://pecl.php.net/package/apc
cd /usr/local/src
curl -L http://pecl.php.net/get/APC-3.1.9.tgz > APC-3.1.9.tgz
tar zxvf APC-3.1.9.tgz
cd APC-3.1.9
phpize
./configure --with-php-config=/usr/local/bin/php-config --enable-apc
apachectl restart
add extension=apc.so in /etc/php.ini
== Apache VHosts
Décommenter l'inclusion des VHost et le ServerName dans Apache (/etc/apache2/httpd. conf) :
Include /private/etc/apache2/extra/httpd-vhosts.conf
...
ServerName myserver
Editer /etc/apache2/extra/httpd-vhosts.conf , supprimer les VHosts d'exemple et ajouter :
Include /Users/USER/www/conf/vhosts.conf
EN TANT QUE USER
mkdir -p ~/www/conf/sites-available ~/www/conf/sites-enabled ~/www/logs ~/www/sites
Créer ~/www/conf/vhosts.conf :
<VirtualHost *:80>
DocumentRoot "/Users/USER/www/conf/default"
<Directory /Users/USER/www/conf/default>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ErrorLog "/Users/USER/www/logs/error.log"
CustomLog "/Users/USER/www/logs/access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName php-info
DocumentRoot "/Users/USER/www/conf/php-info/htdocs"
<Directory /Users/USER/www/conf/php-info>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ErrorLog "/Users/USER/www/logs/error.log"
CustomLog "/Users/USER/www/logs/access.log" common
</VirtualHost>
Include /Users/USER/www/conf/sites-enabled/*
Puis :
mkdir -p ~/www/conf/php-info/htdocs
echo '<?php phpinfo(); ?>' > ~/www/conf/php-info/htdocs/index.php
mkdir -p ~/www/conf/default
echo 'Welcome to Apache, dude!' > ~/www/conf/default/index.html
Ajouter le host :
echo 127.0.0.1 php-info | sudo tee -a /etc/hosts
Vérifier la configuration Apache :
sudo apachectl configtest
Redemarrer apache :
sudo apachectl restart
Vérifier sur http://php-info
== Installer les autres VHosts
Ecrire le VHost dans ~/www/conf/sites-available/mon_vhost
cd ~/www/conf/sites-enabled && ln -s ../sites-available/mon_vhost ./
sudo apachectl restart
TODO
XDebug, Twig PHP extension, Node.js, Postgres
PEAR, CodeSniffer (+ standards of your company), PHPMD, PHPunit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment