Search code examples
ubuntucurlphp-extension

How to get old php.ini settings after I updated to PHP7 and created a new folder with new php.ini files


I updated my ubuntu server and it installed the new PHP7.

I have a PHP code that uses CURL and FORK, and the CURL stopped working.

Got this error:

Message: Call to undefined function curl_init()

I found out I have 2 folders for php in /etc - /etc/php5 (the old one) and the other /etc/php/7.0 with the new PHP.

When I run the info() function I can clearly see it uses the new 7.0 where all my config are set to default!

CURL stopped working and I haven't checked the FORK but I guess it's disabled too.

Oh, and when trying to enable CURL on PHP (changing ;extension=php_curl.dll to extension=php_curl.dll Call to undefined function curl_init().? )

I get this error when running the code that includes CURL:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0

CURL is enabled, double checked that -

var_dump(_isCurl());
function _isCurl(){
    return function_exists('curl_version');
}

returns true.

How did this happen? How is it that Ubuntu doesn't know to do this stuff automatically? And most important:

What is the best RIGHT solution for this?

More helpful info:

root@YHserver:/var/www/html/tools# grep -Hrv ";" /etc/php5 | grep -i "extension="
/etc/php5/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php5/mods-available/curl.ini:extension=curl.so
/etc/php5/mods-available/opcache.ini:zend_extension=opcache.so
/etc/php5/mods-available/json.ini:extension=json.so
/etc/php5/mods-available/gd.ini:extension=gd.so
/etc/php5/mods-available/mcrypt.ini:extension=mcrypt.so
/etc/php5/mods-available/mysql.ini:extension=mysql.so
/etc/php5/mods-available/pdo.ini:extension=pdo.so
/etc/php5/mods-available/mysqli.ini:extension=mysqli.so
/etc/php5/mods-available/readline.ini:extension=readline.so
/etc/php5/apache2/conf.d/pcntl.so:extension=pcntl.so
/etc/php5/apache2/conf.d/pcntl.ini:extension=pcntl.so

root@YHserver:/etc/php5/apache2# grep -Hrv ";" /etc/php/7.0 | grep -i "extension="
/etc/php/7.0/mods-available/ftp.ini:extension=ftp.so
/etc/php/7.0/mods-available/wddx.ini:extension=wddx.so
/etc/php/7.0/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php/7.0/mods-available/calendar.ini:extension=calendar.so
/etc/php/7.0/mods-available/xmlwriter.ini:extension=xmlwriter.so
/etc/php/7.0/mods-available/curl.ini:extension=curl.so
/etc/php/7.0/mods-available/sockets.ini:extension=sockets.so
/etc/php/7.0/mods-available/sysvmsg.ini:extension=sysvmsg.so
/etc/php/7.0/mods-available/tokenizer.ini:extension=tokenizer.so
/etc/php/7.0/mods-available/opcache.ini:zend_extension=opcache.so
/etc/php/7.0/mods-available/json.ini:extension=json.so
/etc/php/7.0/mods-available/gd.ini:extension=gd.so
/etc/php/7.0/mods-available/mcrypt.ini:extension=mcrypt.so
/etc/php/7.0/mods-available/fileinfo.ini:extension=fileinfo.so
/etc/php/7.0/mods-available/exif.ini:extension=exif.so
/etc/php/7.0/mods-available/shmop.ini:extension=shmop.so
/etc/php/7.0/mods-available/pdo.ini:extension=pdo.so
/etc/php/7.0/mods-available/sysvsem.ini:extension=sysvsem.so
/etc/php/7.0/mods-available/mbstring.ini:extension=mbstring.so
/etc/php/7.0/mods-available/mysqli.ini:extension=mysqli.so
/etc/php/7.0/mods-available/xmlreader.ini:extension=xmlreader.so
/etc/php/7.0/mods-available/ctype.ini:extension=ctype.so
/etc/php/7.0/mods-available/xml.ini:extension=xml.so
/etc/php/7.0/mods-available/phar.ini:extension=phar.so
/etc/php/7.0/mods-available/gettext.ini:extension=gettext.so
/etc/php/7.0/mods-available/mysqlnd.ini:extension=mysqlnd.so
/etc/php/7.0/mods-available/simplexml.ini:extension=simplexml.so
/etc/php/7.0/mods-available/readline.ini:extension=readline.so
/etc/php/7.0/mods-available/dom.ini:extension=dom.so
/etc/php/7.0/mods-available/iconv.ini:extension=iconv.so
/etc/php/7.0/mods-available/posix.ini:extension=posix.so
/etc/php/7.0/mods-available/sysvshm.ini:extension=sysvshm.so
/etc/php/7.0/mods-available/xsl.ini:extension=xsl.so
/etc/php/7.0/cli/php.ini:extension=php_curl.dll
/etc/php/7.0/apache2/php.ini:extension=php_curl.dll

It looks like it's


Solution

  • Running

    sudo apt-get dist-upgrade

    solved the problem.