Search code examples
phpinitermux

PHP.ini to configure MySQL


I need php.ini code which will configure MySQL, BTW I am curious why without php.ini it throws error in mysqli_connect(), what key=value's should be in .ini file so that I can work with database. Additional information

I'm on termux

MySQL is running on port 3306,

PHP code for running http server

php -t ./ -S 127.0.0.1:8080 -c ./


Solution

  • Depending on your setup, you may need to specify the full path to your php.ini:

    php -t ./ -S 127.0.0.1:8080 -c /path/to/php.ini
    

    Don't forget to uncomment mysqli in php.ini:

    extension=mysqli
    

    Also database configuration:

    mysqli.default_host = 127.0.0.1
    mysqli.default_port = 3306
    mysqli.default_user = your_mysql_username
    mysqli.default_password = your_mysql_password