I've recently started pset8 mashup and after writing the import php script file I tried to import the US.txt file into the MySQL place database but I keep getting the following error when I do:

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

Can someone please advise me as to how I can overcome this problem? Any help would be much appreciated.

1 Answer 1


As mentioned by Matt Obert in your earlier question:

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

Something went wrong setting up the CS50 PHP library. I assume you use the CS50::query() function for submitting rows to your database, this of course requires the library to properly function.

I recommend you try to run update50 in terminal. If however, that doesn't work I suggest you follow the steps listed here.

  • I tried update50 but got the same error message. I also followed the steps you suggested from the here link but I keep getting an error message stating Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) and Unable to lock the administation directory (/var/lib/dpkg/), are you root? Any suggestions? Oct 25, 2016 at 17:29
  • Prefix the command with sudo, like this: sudo apt-get install php5-gmp and then run the second command. I'm sorry but I cannot refrain from adding this to my comment; xkcd.com/149
    – kluvin
    Oct 25, 2016 at 17:45
  • I've already tried what you've suggested and I think the download worked but when restarted apache50 again and tried the import I've ended up exactly where I started with the same error message as before. I am now at a loss as to how to resolve this problem? Oct 25, 2016 at 18:04
  • I would try to get in contact with the staff at this point, at the bottom of the support page this email is listed sysadmins@cs50.net for questions regarding the IDE.
    – kluvin
    Oct 25, 2016 at 18:33
  • Could you please point me to the support page, so that I can contact them. I'm not too sure which support page you are referring to? Oct 26, 2016 at 19:40

You must log in to answer this question.

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