Hi Laura,
Here’s how you can compile BC Math for PHP 7.0.3 and other versions of PHP in Local:
References:
Based off of the guides above, here’s how you can compile BC Math.
Download the version of PHP you’re running
- Go to https://php.net/get/php-7.0.3.tar.gz/from/a/mirror (change 7.0.3 with the appropriate version)
- Extract the
.tar.gz
into the site’sapp
folder. The extracted folder should be adjacent to thepublic
folder.
Download dependencies
- Right-click on the site in Local’s sidebar
- Go to “Open Site SSH”
- Run
apt-get update && apt-get install -y build-essential autoconf pkg-config
Compile the extension
- Enter
cd /app/php*/ext/bcmath
- Enter
/opt/php/7.0.3/bin/phpize
- Enter
./configure --with-php-config=/opt/php/7.0.3/bin/php-config
- Enter
make && make install
. You should see something like Installing shared extensions:/opt/php/7.0.3/lib/php/extensions/no-debug-non-zts-20151012/
- Run
ls -la PATH_FROM_ABOVE
to see what the new extension filename is. It’ll bebcmath.so
Configuring PHP to use the extension
To finish up, follow the steps after Configure PHP to use the extension in this thread: How do I compile additional PHP extensions? - Local Classic FAQs - Local Community
Pre-compiled BC Math extension for PHP 7.0.3
For your convenience, here’s a precompiled version for PHP 7.0.3 that I created using the steps above.
To use it, you can do the following:
bcmath.so.zip (67.9 KB)
- Download and extract the zip into the site’s
app
folder so it should look something likeapp/bcmath.so
- Right-click on the site in Local and go to “Open Site SSH”
- Run:
mv /app/bcmath.so /opt/php/7.0.3/lib/php/extensions/no-debug-non-zts-20151012/bcmath.so
- Run:
echo -e '\n\nextension = /opt/php/7.0.3/lib/php/extensions/no-debug-non-zts-20151012/bcmath.so' >> /conf/php/7.0.3/php.ini
- Restart the site in Local
- Check the PHP info for BC Math by clicking on the
i
by the PHP version number in Local