SOLVED PHP7 fatal error, upgrading to 1.3.x from RC after ubuntu 15.10 to 16.04 upgrade

  • Testers

    • FOG Version: 1.3.4
    • OS: Ubuntu 16.04 (just upgraded from 15.10)

    So I was helping @mecsr get updated to the latest stable version.
    Discovered we couldn’t get php7 on 15.10 so we upgraded to 16.04
    We also switched it from mysql community to mariadb
    Had to make those switches in .fogsettings as well as apt-get commands. Removed php and mysql and all that jazz.

    The upgrade went smooth and there wasn’t any apparent problem importing the mysql dump into the new mariadb database.

    I finally get the installer to complete as it should and get to the fog login screen. Login and then get a 500 error.
    Here’s what the apache error log says

    [Wed Jan 25 14:24:26.648116 2017] [php7:error] [pid 5160] [client] 
    PHP Fatal error:  Uncaught Error: 
    Call to undefined function curl_init() in /var/www/html/fog/lib/fog/fogurlrequests.class.php:325
    Stack trace:\n#0 /var/www/html/fog/lib/fog/fogurlrequests.class.php(311): FOGURLRequests->_singleCurl(true)
    #1 /var/www/html/fog/lib/fog/fogurlrequests.class.php(602): FOGURLRequests->execute(1, true)
    #2 /var/www/html/fog/lib/pages/dashboardpage.class.php(142): FOGURLRequests->isAvailable(Array)
    #3 /var/www/html/fog/lib/fog/fogpagemanager.class.php(395): DashboardPage->__construct()
    #4 [internal function]: FOGPageManager->{closure}('/var/www/html/f...')
    #5 /var/www/html/fog/lib/fog/fogpagemanager.class.php(400): array_map(Object(Closure), Array)
    #6 /var/www/html/fog/lib/fog/fogpagemanager.class.php(183): FOGPageManager->_loadPageClasses()
    #7 /var/www/html/fog/management/index.php(57): FOGPageManager->render()
    #8 {main}\n  thrown in /var/www/html/fog/lib/fog/fogurlrequests.class.php on line 325, referer: http://mefog/fog/management/index.php

    Saw a similar post that suggested trying the working-1.3.4 branch, so I did with no luck.
    Did I miss a reconfiguration step or something?

  • Testers

    @mecsr reported to me that they got it fixed, don’t know how yet. I’ll post it when I know.

  • First, I think app armor was blocking the fog update, so I disabled all of apparmor, but it still didn’t work and I got the same error about apparmor in the logs still. So I dug deeper and disabled it further and/or removed it.

    Then, it still didn’t work, so I looked at the logs some more. I made sure apache was working and fixed a few things there. I also made sure mysql was working.

    I tried a lot of other things, but I think this mysql upgrade with my root user and root password is what was really needed. I had to do the mysql update manually with my own command instead:

    sudo mysql_upgrade -u root -p

    Then, I re-ran the fog update and it worked. If that doesn’t work for anyone else, let me know and I can give you more details on other things I did to fix it. It is all working now. Thank you! Fog is awesome!

    BOTTOM LINE = Follow the errors in the logs. I did sudo journalctl -xe a lot and also tail -n 20 /var/log/mysql/error.log to see what was going on.

  • Testers

    @mecsr reported to me that they got it fixed, don’t know how yet. I’ll post it when I know.

  • Senior Developer

    @JJ-Fullmer Correct.

  • Testers

    @Tom-Elliott Would that be the working-1.3.4 branch or the dev-branch?
    The last attempt was from the working-1.3.4 branch and it looks like you pushed to it 2 hours ago, so I’m guessing that one.

  • Testers

    @Quazz I know, I’ve done the switch from mysql to mariadb a couple of times and every time except for this one it just used the existing mysql dbs without issue.

  • Senior Developer

    Please try install 1.3.4 RC 2? It should try “forcing” PHP 7.1.

    You may want to remove the php_ver and php_verAdds lines from the .fogsettings file. Retry the installer.

  • Moderator

    All of this sounds weird to me given that Mariadb is a drop-in replacement for mysql.

  • Testers

    @Wayne-Workman We kind of already tried that. I installed it and it didn’t work. So I inspected the database and discovered that the mariadb install hadn’t transferred over the mysql db. Then I imported and tried again. Unless I’m remembering wrong. I’ll try that again just to be sure. But where would we go next?

  • Just for troubleshooting purposes only, keep the db dump on hand, drop the fog database, re-run the installer and see if it works.

    The purpose of this is to isolate if it’s an issue with the imported DB, or with something else.

    Here’s how to drop the db:

    drop database fog;