sebastiaandraaisma Posted December 12, 2006 Share Posted December 12, 2006 Hi my name is Sebastiaan and I'm new to php, MySQL and Appache :)I wrote some simple php scripts to test and help me forward in learning the language, but now I'm at a point where I'm stuck.I will try to describe my problem.I can't connect to the database trough php, I have a simple out of the book connection script that should show me an error message when I can not connect.I do not receive any error message. In the php.info I have the following settings:error_reporting E_AllDisplay_errors = off (I also tried the script with this function on)Display_startup_errors = off (also this one I tried with both on and off)When I try to use the script in both IE and Firefox I see an empty screen.The MySQL command line client works. I can see databases and tables and add data.My laptop is a XP 2002 Intel P. 1,86Ghz 504Mb ramThe MySQL status says:Ver 14.12 Distrib 5.0.22, for win32 (ia32)Connection ID 2Current database (shows empty)Current user root@localhost (I'm running off-line)SSL Not in useUsing delimiter ;Server version 5.0.22-community-ntProtocol version 10Connection localhost via TCP/IPCharacterset latin1TCP port 3306I have attached the php file where the data is written.I hope some one knows what my problem could be? :)I personally think its a setting somewhere but I'm to new to all of this to see where.Any help is apriciated!Kind regards,Sebastiaan[attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 12, 2006 Share Posted December 12, 2006 The reason is because you have the display_errors directive turned off in the php.ini. Turn this setting on.When you turn it on, you must save the php.ini and restart the server for the new php.ini changes to come into effect. If you dont restart the server the new settings will not be loaded.If you have done this, then confirm PHP is using the correct php.ini. You can do this by creating a new script (call it info.pphp) and add the following code to it:[code=php:0]<?php phpinfo(); ?>[/code]Now load this file up and look for the following line:[b]Configuration File (php.ini) Path[/b]To the right of that it should state the full path to the php.ini file PHP is using, is this the correct path to the php.ini you are editing? Quote Link to comment Share on other sites More sharing options...
sebastiaandraaisma Posted December 13, 2006 Author Share Posted December 13, 2006 Thank you for your advise.I did turned this setting on, but because I did not restarted the server I guess it didn't help :)I will do the same and restart the server this time.I don't know the path out of my head as I'm right now in an internet cafe, but I'm using the default path and used the "recommended php.ini" that came with the instalation.Thank you for taking the time to answer.Kind regards,Sebastiaan Quote Link to comment Share on other sites More sharing options...
sebastiaandraaisma Posted December 13, 2006 Author Share Posted December 13, 2006 I have turned the setting on, saved the php.ini and re-started the server.This time I did get an error, indicating that I am working on the right php.ini file.The error I got was:Fatal error: Call to undefined function mysqli_connect() in C:\www.globalhome.eu\indextest.php on line 4This is the text on line 4:$mysqli = mysqli_connect("localhost", "joeuser", "somepass", "testDB");I replaced mysqli_connect with mysql_connect but this gave the same error message.I did expect to read the error "Connect failed" as the script I'm using saysif (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit();Any thoughts on this?Kind regards,Sebastiaan Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 14, 2006 Share Posted December 14, 2006 You will need to enable the mysqli extension if you wish to use the mysqli library. I have a thread setup in the FAQ board [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]here[/url] - that should help youNOTE: That FAQ is setup to enable the standard mysql library, if you want to use the mysqli library then enable the php_mysqli.dll extension in stead. Quote Link to comment Share on other sites More sharing options...
sebastiaandraaisma Posted December 16, 2006 Author Share Posted December 16, 2006 Thank you that solved the problem!!! :)Have a different problem now, but I will see if I can find the answer in the forum before I will post a new topic.Thank you for your helpSebas. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.