• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

configure PHP with bcmath

CPJ

New Pleskian
Hi,

I am currently using 9.2 with Debian 5 and have an application that needs PHP's bcmath module. This is not included in the PHP version that is installed with 9.2 - right ?

If I upgrade to 9.3, will this also upgrade PHP to a newer version with bcmath ?

Or do I need to recompile PHP - where are the source files for PHP and what is the exact command I need to use ?

Thanks for your help

CPJ
 
According to

# php -i | grep bcmath

Configure Command => './configure' '--host=x86_64-redhat-linux-gnu' '--build=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-ncurses=shared' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--enable-dbase=shared' '--with-pspell=shared' '--with-mcrypt=shared,/usr' '--with-mhash=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--with-unixODBC=shared,/usr'
 
Thanks IgorG - I've tested it on my version and I can see it there too...
 
Thanks IgorG, but I still seem to have a problem...

When I run "php -i" at the command line, I get the same response as you. BUT when I run "phpinfo();" from a php file, I get a different, much shorter configure list, without bcmath, and further down there is no section of bcmath information - (see attached screen shot).

Also, when I run the following from a php file

if (function_exists('bcadd')) {
echo "bcadd is there.<br />\n";
} else {
echo "bcadd is NOT there.<br />\n";
}

I get "bcadd is NOT there."

What am I doing wrong ? Do I need to re-install PHP ? How do I do this ?

Thanks...
 

Attachments

  • phpconfig1.jpg
    phpconfig1.jpg
    215.5 KB · Views: 11
You can just use received ./configure with default options and add your additional options there for compilation PHP from source.
 
Hi! Got the same problem

that doesn't solve the problem!
After reinstalling, php -i shows the data of the new php-Version but my phpinfo()-file in the browser still shows the old information... Obviously plesk gets his php from somewhere else...
 
There are two PHP in Plesk - one for Plesk admin interface (lighttpd) and one for client's sites (Apache). Make sure that you use Apache but not lighttpd.
 
I fixed it by moving to Plesk 9.3, so never found out what the real problem was...

Thanks for your help...
 
Yes - with 9.3.0 my shop software was able to find and use the PHP bcmath library functions. With 9.2.x it complained that the bcmath library was missing... I don't know what the real differences are between 9.2.x and 9.3.0, but as far as my shop software is concerned, this is what it thinks...

Thanks for your help...
 
funny...

For me it didn't...
Where exactly is the apache's php is located?
I stopped all service and tried to simply replace the php with the one I knew '--enable-bcmath=shared'...
But it seems, I've not yet found the right one :eek:(
 
Plesk's php:

/usr/local/psa/admin/bin/php
/usr/local/psa/admin/conf/php.ini

Client's php:

/usr/bin/php
/etc/php.ini
 
/usr/bin/php is the one I do address from the shell...
the Configure Command from /usr/local/psa/admin/bin/php is quite shorter, but it's not the one i get in the browser...
None of them is... Where does this php come from??? :(
 
Do not touch Plesk admin's PHP /usr/local/psa/admin/bin/php in any way! Plesk will be broken.
All what you need is client's PHP /usr/bin/php
 
I didn't intend to modify Plesk admin's PHP...
But as I tried to explain (and what CPJ wrote in #4): This is not the Version phpinfo() discribes in the browser...
 
configure directory...

What about the ./configure command, in which directory do I run it from?

Can I add bcmath only to the client's PHP?
 
What about the ./configure command, in which directory do I run it from?

Can I add bcmath only to the client's PHP?

You should run it inside directory with unpacked PHP source.
Yes, it is all only for client's PHP. You never shouldn't touch admin's PHP!
 
Back
Top