mirror of
https://github.com/danog/PrimeModule.git
synced 2024-11-30 04:39:09 +01:00
PHP 8.1 support
This commit is contained in:
parent
0d5006daf0
commit
2328b1ec43
@ -89,10 +89,10 @@ class PrimeModule
|
||||
public static function python_single($what)
|
||||
{
|
||||
if (function_exists('shell_exec')) {
|
||||
$res = trim(shell_exec('timeout 10 python2 '.__DIR__.'/prime.py '.$what.' 2>&1'));
|
||||
$res = trim(shell_exec('timeout 10 python2 '.__DIR__.'/prime.py '.$what.' 2>&1') ?? '');
|
||||
if ($res == '' || is_null($res) || !is_numeric($res)) {
|
||||
copy(__DIR__.'/prime.py', getcwd().'/.prime.py');
|
||||
$res = trim(shell_exec('timeout 10 python2 '.getcwd().'/.prime.py '.$what.' 2>&1'));
|
||||
$res = trim(shell_exec('timeout 10 python2 '.getcwd().'/.prime.py '.$what.' 2>&1') ?? '');
|
||||
unlink(getcwd().'/.prime.py');
|
||||
if ($res == '' || is_null($res) || !is_numeric($res)) {
|
||||
return false;
|
||||
@ -128,10 +128,10 @@ class PrimeModule
|
||||
public static function python_single_alt($what)
|
||||
{
|
||||
if (function_exists('shell_exec')) {
|
||||
$res = trim(shell_exec('python '.__DIR__.'/alt_prime.py '.$what.' 2>&1'));
|
||||
$res = trim(shell_exec('python '.__DIR__.'/alt_prime.py '.$what.' 2>&1') ?? '');
|
||||
if ($res == '' || is_null($res) || !is_numeric($res)) {
|
||||
copy(__DIR__.'/alt_prime.py', getcwd().'/.alt_prime.py');
|
||||
$res = trim(shell_exec('python '.getcwd().'/.alt_prime.py '.$what.' 2>&1'));
|
||||
$res = trim(shell_exec('python '.getcwd().'/.alt_prime.py '.$what.' 2>&1') ?? '');
|
||||
unlink(getcwd().'/.alt_prime.py');
|
||||
if ($res == '' || is_null($res) || !is_numeric($res)) {
|
||||
return false;
|
||||
|
@ -1,17 +1,5 @@
|
||||
#!/bin/bash
|
||||
export PATH=$PATH:~/.phpenv/versions/$(phpenv version-name)/bin
|
||||
|
||||
cd /tmp &&
|
||||
git clone https://github.com/CopernicaMarketingSoftware/PHP-CPP &&
|
||||
cd PHP-CPP &&
|
||||
make -j16 &&
|
||||
sudo make install &&
|
||||
|
||||
cd ../ &&
|
||||
git clone https://github.com/danog/PrimeModule-ext &&
|
||||
cd PrimeModule-ext &&
|
||||
make -j16 &&
|
||||
echo "extension=$PWD/primemodule.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini &&
|
||||
cd ..
|
||||
sudo apt-get install build-essential && git clone https://github.com/danog/PrimeModule-ext && cd PrimeModule-ext && make -j$(nproc) && sudo make install
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user