0

I have laravel project on Centos Machine on Google cloud . I have this problem when I am trying to access the system

Missing BC Math or GMP extension. (View: /var/www/html/alparslan/resources/views/frontend/index.blade.php) this is the code

  $datenow=Carbon::now();//$this->turkcetarih_formati('j F Y');

     //   $users = User::select('id', 'name', 'username', 'email', 'email_verified_at', 'updated_at', 'status')->get();

        $studentcount= User::role('student')->count();
        $teachercount=  User::role('teacher')->count();
//        foreach ($users as $user) {
//            foreach ($user->getRoleNames() as $userrole)
//                if($userrole=='student')
//                    $studentcount++;
//            if($userrole=='teacher')
//                $teachercount++;
//        }
        $usercount=User::count();
        $teacherPercent=number_format(($teachercount/$usercount)*100,2);
        $studentPercent=number_format(($studentcount/$usercount)*100,2);

        $questioncount=Question::count();
        $questionBankcount=QuestionBank::count();
        $subjectcount=Subject::count();

 $ php -m | grep gmp
gmp
 $ php -m | grep bc
bcmath

it is whowing the gmp andd bcmath is already installed this is the result of php --ini

 $ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/20-bcmath.ini,
/etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-dom.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gd.ini,
/etc/php.d/20-gettext.ini,
/etc/php.d/20-gmp.ini,
/etc/php.d/20-iconv.ini,
/etc/php.d/20-intl.ini,
/etc/php.d/20-json.ini,
/etc/php.d/20-mbstring.ini,
/etc/php.d/20-mysqlnd.ini,
/etc/php.d/20-pdo.ini,
/etc/php.d/20-phar.ini,
/etc/php.d/20-simplexml.ini,
/etc/php.d/20-sockets.ini,
/etc/php.d/20-sodium.ini,
/etc/php.d/20-sqlite3.ini,
/etc/php.d/20-tokenizer.ini,
/etc/php.d/20-xml.ini,
/etc/php.d/20-xmlwriter.ini,
/etc/php.d/20-xsl.ini,
/etc/php.d/30-mysqli.ini,
/etc/php.d/30-pdo_mysql.ini,
/etc/php.d/30-pdo_sqlite.ini,
/etc/php.d/30-xmlreader.ini,
/etc/php.d/40-zip.ini

it is also showing the gmp and bcmath this is the content of /etc/php.d/20-bcmath.ini

; Enable bcmath extension module
extension=bcmath

and this is the content of /etc/php.d/20-gmp.ini

; Enable gmp extension module
extension=gmp 

both files show that the extenstion is already enabled , I removed composer.lock and re installed the backages and the same error has been shown

enter image description here enter image description here

Wesley Smith
  • 19,401
  • 22
  • 85
  • 133
Netcom Ask
  • 33
  • 4
  • 7
  • composer.lock and your projects packages dont have anything to do with the php modules that are installed/enabled for your server. They might require that you have a module installed/enabled to work but reloading your project dependencies wouldnt change anything about the server itself. – Wesley Smith Nov 04 '20 at 07:29
  • When you say "I have this problem when I am trying to access the system", what exactly are you doing when you get this error? – Wesley Smith Nov 04 '20 at 07:29
  • Okay , so what should I do now ? – Netcom Ask Nov 04 '20 at 07:30
  • Offhand, I would guess that your webserver is not using the same php as your command line. If you can get some other page to load, perhaps you can do a `echo phpinfo();` and review the php environment as seen/used by your webserver to confirm? – Wesley Smith Nov 04 '20 at 07:35
  • @WesleySmith thank you for reply, I updated the question and include the code that I am using – Netcom Ask Nov 04 '20 at 07:35
  • @WesleySmith , I just runned phpinfo and I can see bcmath in it , so from where can I solve the problem ? how can I solve the problem , thank you again ,best regards – Netcom Ask Nov 04 '20 at 07:51
  • Have you recently installed these modules? Also, in that output, it should show you where its loading `php.ini` from, is that the file path you expect (/etc/php.ini) , or is it pointing to some other `php.ini`? – Wesley Smith Nov 04 '20 at 07:54
  • I updated my question with the phpinfo screen shot – Netcom Ask Nov 04 '20 at 07:55
  • @WesleySmith _Yes I installed all these modules but still not work – Netcom Ask Nov 04 '20 at 08:15

1 Answers1

-2
sudo apt-get install php-gmp

this will help for Ubuntu