0

I had an error trying to restart apache2 but when I resolved this problem, with some help on this forum, I'm now getting the following error message:

Fatal error: CS50 Library requires bcmath or gmp extension module in /home/ubuntu/workspace/pset7/vendor/library50-php-5/CS50/CS5‌​0.php on line 48.

The error message reads:

Fatal error: CS50 Library requires bcmath or gmp extension module in /home/ubuntu/workspace/pset7/vendor/library50-php-5/CS50/CS5‌​0.php on line 48. 

When I try to access the web server in my IDE window.

EDIT (2016-10-22):

Copied from an unrelated question

I set the permissions on ./import to chmod 700 but now I'm getting the following error, from the command line:

Fatal error: CS50 library requires bcmath or bmp extension module in /home/ubuntu/workspace/pset8/vendor/library50-php-5/CS50/CS5‌​0.php on line 48

Am I missing out something here in my import file php script file?

1 Answer 1

0

This error is not related to the Apache2 zombie process which we resolved over here.

It is also not related to the permissions on your import PHP file, which we resolved here.

Your latest error is triggered by the following code block at the very top of CS50.php (because everything before line 45 is a comment):

// require extensions for Janrain's libary
if (!extension_loaded("bcmath") && !extension_loaded("gmp"))
{
    trigger_error("CS50 Library requires bcmath or gmp extension module", E_USER_ERROR);
}

In a nutshell, the CS50 Library is something David Malan wrote for you, as a friendly front-end to something called PHP PDO.

You can read the source code for yourself and see how he did it (and what else it does) by poking around inside the vendor directories inside pset7 and pset8:

~/workspace/pset7/ (master) $ tree vendor
vendor
└── library50-php-5
    └── CS50
        ├── CS50.php
        └── share
            └── php-openid-2.3.0
                ├── Auth
                │   ├── OpenID
                │   ├── [ more stuff inside this directory ]

This php-openid-2.3.0 directory contains code written by JanRain, which David Malan borrows here in order to authenticate with Harvard or edX using OpenID.

Your error seems to indicate that your local PHP environment is not set up properly to support this feature of the CS50 Library.

On the other hand, you finished pset7, so this error might not prevent you from finishing pset8 as well.

1
  • Sorry for getting back to you so late but I am not sure what you mean by using the CS50 Library? I have only used the CS50 library inside of the IDE for the psets. I am now encountering a similar problem with pset8 when I try to run the import php script file from the command line to import the US.txt csv file into the MySQL database, which is giving me exactly the same error message. Any advice would be appreciated. Oct 22, 2016 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .