Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active February 18, 2022 00:24
Show Gist options
  • Save CMCDragonkai/9947217 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/9947217 to your computer and use it in GitHub Desktop.
CONFIGURATION: PHPBrew Configuration
Build PHP with PHPBrew
WORK IN PROGRESS
http://devkardia.com/easyblog/ubuntu-12-04-multiple-php-versions-and-virtualmin-using-phpbrew.html
Use these php.ini files
- Make sure to use TCP sockets for everything. Unix Domain Sockets are BAAAAD!
- Set session save path to the temporary directory
- MySQL socket needs to be setup
php.ini
- Change the session_save_path
Use this php-fpm.conf
- TCP sockets for FPM
php-fpm.conf
All of this will be automated. But configurable from the beginning. That is one can choose how the PHP layer is constructed, what directives to use during PHPBrew construction, modifications to the PHP.ini. And modifications to the php-fpm.conf. All built for a specific environment. If you want to change. Feel free to FORK it, then make your changes and use that instead.
Using PHPBrew to maintain different versions of PHP:
```
echo "This is going to take sometime. Go do something else."
sudo apt-get build-dep php5
sudo apt-get install -y php5 php5-dev php-pear autoconf automake curl build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev
sudo apt-get install -y libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4
sudo apt-get install -y libssl-dev openssl
sudo apt-get install -y gettext libgettextpo-dev libgettextpo0
sudo apt-get install -y libicu48 libicu-dev
sudo apt-get install -y libmhash-dev libmhash2
sudo apt-get install -y libmcrypt-dev libmcrypt4
sudo apt-get install mysql-server mysql-client libmysqlclient-dev libmysqld-dev
curl -O https://raw.github.com/c9s/phpbrew/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew
phpbrew init
echo "# setup phpbrew" >> ~/.bashrc
echo "export PHPBREW_SET_PROMPT=1" >> ~/.bashrc
echo "source ~/.phpbrew/bashrc" >> ~/.bashrc
# MYSQL Sock option is the default location of the mysql daemon socket on Ubuntu
phpbrew install 5.5.10 +all -- --enable-maintainer-zts --with-mysql-sock=/var/run/mysqld/mysqld.sock
phpbrew clean
phpbrew list
phpbrew use 5.5.10
phpbrew ext install xdebug
phpbrew ext install pthreads
phpbrew ext install yaml
phpbrew install-composer
echo "export PATH=$PATH:/home/cmcdragonkai/.composer/vendor/bin:" >> ~/.bashrc
echo "Edit the php.ini with 'phpbrew config'"
echo "Edit the php-fpm.conf with 'phpbrew fpm config'"
echo "Manage PHP-FPM using phpbrew fpm start or phpbrew fpm stop"
```
Consider these too:
sudo apt-get install libmcrypt-dev libfreetype6
phpbrew install php-5.4.13 +default +mysql +gettext +mcrypt +intl +iconv +ftp +exif +dba +openssl +soap +ipv6 +imap +debug +cgi +exif +apxs2=/usr/bin/apxs2 -- --with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --enable-wddx --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-freetype-dir=/usr/include/freetype2/freetype
We also should make MYSQL connect over TCP instead of unix domain socket. It's not scalable to clusters unless we use TCP socket.
@CMCDragonkai
Copy link
Author

This note needs to be cleaned up.

To do phpbrew on windows is difficult. It's far easier to just utilise Cygwin Ports and install what is necessary. It can kind of manage versions too.

Here: http://cygwinports.org/

Install your PHP with any extensions. Remember that some extensions require dependencies that are in the main repository, so you'll need to have those dependencies installed prior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment