2

I am using Tomcat 6. I am running a php script using the JavaBridge. I get the following error when I run my code.

Fatal error: Call to undefined function mysqli_connect() in C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\xxxx\xxxxx.php on line 534

Please help.

5 Answers 5

2

I'm not really sure what I've done but mine is working as I read the documentation. in my case it's MySQL and I am using Tomcat 7.

  1. copy the correct VERSION of the PHP extension "php_mysql.dll" to the correspond "ext" directory, in my case it's in "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\aeu\WEB-INF\cgi\amd64-windows\ext"

  2. uncomment/add this line,

    extension = php_mysql.dll

in php.ini and mysql.ini file, in my case there're as C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\aeu\WEB-INF\cgi\amd64-windows\php.ini and C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\aeu\WEB-INF\cgi\amd64-windows\conf.d\mysql.ini

and lastly restart Tomcat. good luck.

Sign up to request clarification or add additional context in comments.

Comments

1

I would do two things:

  • Make sure that location of php_mysql.dll is included in the PATH env variable.
  • Open your php.ini file, and look under the extensions. Make sure that the line for loading php_mysql.dll is not commented (make sure there isn't a ; in front of it).

1 Comment

@unicornaddict: I did exactly as you said. I have installed WAMP. I added C:\wamp\bin\php\php5.3.0\ext to my PATH env variable. Also the php.ini is OK. I restarted tomcat. I am still getting the same error.
1

Probably due to some missing libmysql.dll, try to look for this file (windows find could help) and make sure it sit's on a directory belonging to you PATH. (see this topic)

1 Comment

Hum, try to put libmysql.dll in c:\windows\system32 and see if that's help.
0

You may need to configure PHP with the option: --with-mysql = path_to_mysql

I would just like to highlight Bruces question here relates to using the mysqli API (not the older mysql API)

Comments

0

Managed to get this working. HAD TO USE mysqli.ini INSTEAD OF mysql.ini in my case:
- Apache-Tomcat-9.0.10
- PHP Version 5.6.38
- JavaBridgeTemplate721.war
- MySql 8.0.12
...first had to copy php5ts.dll and php-cgi.exe to setup the PHP enabled Tomcat project to the: \WEB-INF\cgi\x86-windows\
and then copy php_mysqli.dll and setup the mysqli.ini to enable the mysqli.

Comments

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.