1

I have installed php7.2, apache and mysql. When I copied codeigniter folder in my var/www/html it runs but give one error as

A PHP Error was encountered

Severity: Core Warning

Message: PHP Startup: Unable to load dynamic library 'php_mysqli' (tried: /usr/lib/php/20170718/php_mysqli (/usr/lib/php/20170718/php_mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/php_mysqli.so (/usr/lib/php/20170718/php_mysqli.so: cannot open shared object file: No such file or directory))

Filename: Unknown

Line Number: 0

Backtrace:

I search for the same and tried with different solution as updating php.ini file but still getting the same error.

I am using Ubuntu 18.04.1 LTS OS

Your help would be appreciated. Thanks.

3
  • This is a PHP issue and not CodeIgniter. See this SO question Commented Nov 21, 2018 at 19:32
  • Make sure that you installed lamp stack correctly and added all required dependencies. Commented Nov 21, 2018 at 22:13
  • have you installed php7.2-mysql? and restarted server after installation? Commented Nov 22, 2018 at 15:37

2 Answers 2

2

Install php extension for mysql.

use this command

sudo apt-get install php-mysql

After installation restart apache with this command

sudo service apache2 restart

update

If sudo apt-get install php-mysql

not work for you then you should use

sudo apt-get install php7.2-mysql
Sign up to request clarification or add additional context in comments.

3 Comments

php-mysql is installed and it is working fine with core php but not with codeigniter.
Tried both ways but anyone didn't help me.
@Kosmos First check the php version used by the web server it could be different than the version returned by php --version cmd. After knowing the php version try installing the php-mysql package for that php version using the cmd as sudo apt-get install php<version>-mysql. Don't forget to replace <version> with the one used by the web server.
0

You should open php.ini file and check if the line:

 extension=mysqli.so 

presented and not commented with # sign

1 Comment

php.ini lines are commented with ;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.