|
Posted by Jerry Stuckle on 03/22/07 13:02
Bruce A. Julseth wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:mPKdnQd7cOokDZzbnZ2dnUVZ_uHinZ2d@comcast.com...
>> Bruce A. Julseth wrote:
>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>> news:rJOdndH_aOZq1pzbnZ2dnUVZ_qemnZ2d@comcast.com...
>>>> Bruce A. Julseth wrote:
>>>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>>> news:TOqdnQaFier9jJzbnZ2dnUVZ_vmqnZ2d@comcast.com...
>>>>>> Bruce A. Pulse's wrote:
>>>>>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>>>>> news:fICdnY7P1clJ8J3bnZ2dnUVZ_vvinZ2d@comcast.com...
>>>>>>>> Bruce A. Julseth wrote:
>>>>>>>>> "Erwin Moller"
>>>>>>>>> <since_humans_read_this_I_am_spammed_too_much@spamyourself.com>
>>>>>>>>> wrote in message news:45fff99d$0$69886$e4fe514c@news.xs4all.nl...
>>>>>>>>>> Bruce A. Julseth wrote:
>>>>>>>>>>
>>>>>>>>>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>>>>>>>>> news:IamdnTLNMrgA02LYnZ2dnUVZ_oLinZ2d@comcast.com...
>>>>>>>>>>>> Bruce A. Julseth wrote:
>>>>>>>>>>>>> "Jeff" <jeff@quixion.net> wrote in message
>>>>>>>>>>>>> news:1174344779.712020.258000@p15g2000hsd.googlegroups.com...
>>>>>>>>>>>>>> Get rid of the @ in front of the $db = new mysqli( ...
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> That is suppressing any errors on that line of code. Then it
>>>>>>>>>>>>>> should
>>>>>>>>>>>>>> show you in your browser what the error is and then we can
>>>>>>>>>>>>>> help you
>>>>>>>>>>>>>> further.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Also, you can include $Database as the 4th parameter in your
>>>>>>>>>>>>>> mysqli
>>>>>>>>>>>>>> constructor to connect to that specific database.
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Okay, I now have
>>>>>>>>>>>>>
>>>>>>>>>>>>> $Host = "localhost";
>>>>>>>>>>>>> $User = "Fred";
>>>>>>>>>>>>> $Database = "house";
>>>>>>>>>>>>> $Password = "mypw"
>>>>>>>>>>>>>
>>>>>>>>>>>>> echo "before mysqli<br />Host: " . $Host . "<br />" . $User .
>>>>>>>>>>>>> "<br />"
>>>>>>>>>>>>> .
>>>>>>>>>>>>> $Database;
>>>>>>>>>>>>>
>>>>>>>>>>>>> $db = new mysqli($Host, $User, $Password);
>>>>>>>>>>>>>
>>>>>>>>>>>>> echo "Connection is " . mysqli_connect_errno();
>>>>>>>>>>>>>
>>>>>>>>>>>>> I didn't add the database to the mysqli parameter list.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I still never got to the 2nd echo statement. Firefox gives me a
>>>>>>>>>>>>> "done"
>>>>>>>>>>>>> in the lower left corner. The "mysqli" is the very first MySQL
>>>>>>>>>>>>> command I
>>>>>>>>>>>>> execute in my program. Do I need "Create" or "instantiate"
>>>>>>>>>>>>> something
>>>>>>>>>>>>> first? I'm running PHP 5.2.0 (re: phpinfo()) and MySQL Server
>>>>>>>>>>>>> 5.0 [I'm
>>>>>>>>>>>>> not sure what version. How can I find out?]
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> Add this to the beginning of your script:
>>>>>>>>>>>>
>>>>>>>>>>>> error_reporting(E_ALL);
>>>>>>>>>>>> ini_set("display_errors", "1");
>>>>>>>>>>>>
>>>>>>>>>>>> And see what error messages you get. Or check your PHP error
>>>>>>>>>>>> log (which
>>>>>>>>>>>> may be in the Apache log).
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> ==================
>>>>>>>>>>>> Remove the "x" from my email address
>>>>>>>>>>>> Jerry Stuckle
>>>>>>>>>>>> JDS Computer Training Corp.
>>>>>>>>>>>> jstucklex@attglobal.net
>>>>>>>>>>>> ==================
>>>>>>>>>>> Adding the above code gave the error message:
>>>>>>>>>>>
>>>>>>>>>>> Fatal error: Class 'mysqli' not found in
>>>>>>>>>>> C:\Inetpub\wwwroot\SerenadeHOA\php\functions.php on line 47
>>>>>>>>>>>
>>>>>>>>>>> This implies to me that I have a configuration problem. What
>>>>>>>>>>> should I look
>>>>>>>>>>> for.
>>>>>>>>>>>
>>>>>>>>>>> My php.ini is in my C:\windows directory.:
>>>>>>>>>>> I have extension_dir = "c:/php5/ext"
>>>>>>>>>>>
>>>>>>>>>>> What else should I check?
>>>>>>>>>> search for mysqli in your php.ini and comment it in.
>>>>>>>>>> Make sure you have the file in a place where PHP looks.
>>>>>>>>>>
>>>>>>>>>> Next thing to do is running phpinfo() and see if it finds and
>>>>>>>>>> loads mysqli.
>>>>>>>>>>
>>>>>>>>>> Good luck.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Erwin Moller
>>>>>>>>>>
>>>>>>>>>>> Thanks..
>>>>>>>>> I checked my PHPInfo.php with Ctrl-F of the html code and found NOT
>>>>>>>>> reference to mysqli. I am referencing C:\Windows\php.ini and
>>>>>>>>> that's the correct directory.
>>>>>>>>>
>>>>>>>>> Here are the mysqli settings in my php.ini.
>>>>>>>>>
>>>>>>>>> [MySQLi]
>>>>>>>>>
>>>>>>>>> ; Maximum number of links. -1 means no limit.
>>>>>>>>> mysqli.max_links = -1
>>>>>>>>>
>>>>>>>>> ; Default port number for mysqli_connect(). If unset,
>>>>>>>>> mysqli_connect() will use
>>>>>>>>> ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or
>>>>>>>>> the
>>>>>>>>> ; compile-time value defined MYSQL_PORT (in that order). Win32
>>>>>>>>> will only look
>>>>>>>>> ; at MYSQL_PORT.
>>>>>>>>> mysqli.default_port = 3306
>>>>>>>>>
>>>>>>>>> ; Default socket name for local MySQL connects. If empty, uses the
>>>>>>>>> built-in
>>>>>>>>> ; MySQL defaults.
>>>>>>>>> mysqli.default_socket =
>>>>>>>>>
>>>>>>>>> ; Default host for mysql_connect() (doesn't apply in safe mode).
>>>>>>>>> mysqli.default_host =
>>>>>>>>>
>>>>>>>>> ; Default user for mysql_connect() (doesn't apply in safe mode).
>>>>>>>>> mysqli.default_user =
>>>>>>>>>
>>>>>>>>> ; Default password for mysqli_connect() (doesn't apply in safe
>>>>>>>>> mode).
>>>>>>>>> ; Note that this is generally a *bad* idea to store passwords in
>>>>>>>>> this file.
>>>>>>>>> ; *Any* user with PHP access can run 'echo
>>>>>>>>> get_cfg_var("mysqli.default_pw")
>>>>>>>>> ; and reveal this password! And of course, any users with read
>>>>>>>>> access to this
>>>>>>>>> ; file will be able to reveal the password as well.
>>>>>>>>> mysqli.default_pw =
>>>>>>>>>
>>>>>>>>> ; Allow or prevent reconnect
>>>>>>>>> mysqli.reconnect = Off
>>>>>>>> Do you have ext=extension=php_mysqli.dll in your php.ini?
>>>>>>>>
>>>>>>>> --
>>>>>>>> ==================
>>>>>>>> Remove the "x" from my email address
>>>>>>>> Jerry Stuckle
>>>>>>>> JDS Computer Training Corp.
>>>>>>>> jstucklex@attglobal.net
>>>>>>>> ==================
>>>>>>> extension=php_mysqli.dll is set
>>>>>>>
>>>>>>> extension=php_mysql.dll is also set. Should I remove that?
>>>>>> No, it's perfectly fine to have both of them. Are you sure you're
>>>>>> editing the correct php.ini file? Where does phpinfo() say it's
>>>>>> getting it from?
>>>>>>
>>>>>> Does phpinfo() show you're loading the mysql extension? If neither
>>>>>> are being loaded, chances are there's a problem with the location of
>>>>>> your libmysqlclient.dll file (probably the location). But if the
>>>>>> mysql extension is being loaded, then you should be able to get to the
>>>>>> MySQL libs.
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> ==================
>>>>>> Remove the "x" from my email address
>>>>>> Jerry Stuckle
>>>>>> JDS Computer Training Corp.
>>>>>> jstucklex@attglobal.net
>>>>>> ==================
>>>>> php.ini is coming from C:\Windows.
>>>>>
>>>>> Running phpinfo.php I find NO mention of mysql anywhere. Perhaps I
>>>>> missed it. I have sent you a screen shot of the phpinfo.php..
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>> OK, that means it isn't finding something it needs for mysql - probably
>>>> libmysql.dll. Ensure your mysql\bin directory is in your PATH or
>>>> libmysql.dll is in a directory in your PATH.
>>>>
>>>> And sorry - I don't have a screen shot handy - but if it were there
>>>> you'd see it.
>>>>
>>>> --
>>>> ==================
>>>> Remove the "x" from my email address
>>>> Jerry Stuckle
>>>> JDS Computer Training Corp.
>>>> jstucklex@attglobal.net
>>>> ==================
>>> C:\Program Files\MySQL\MySQL Server 5.0\bin is in my path. I went to a
>>> command line and "Dir"'d this directory to make sure nothing hoaky and
>>> the dir worked. libmysql.dll is in this path.
>>>
>>> BTW: I emailed you (Jerry: removing the x) my php.ini and my phpinfo.php
>>> as a pdf file. Did you get it?
>> Also, another though here, Bruce. Do you have your permissions set to
>> allow your Apache user to read/execute libmysql.dll?
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstucklex@attglobal.net
>> ==================
>
> Well, it's working!! And, I'm not sure why!! My guess is that a change I
> made earlier was the correct one but I FAILED to restart Apache.
>
> Thanks for you help.. Since I really am just learning, I'm sure I'll be
> back. But I have learned a lesson. ALWAYS restart Apache when you make
> changes to php.ini and/or the apache config file.
>
> Thanks again..
>
> Bruce
>
>
Yep, I guess that's partly my fault, also. I just assumed you restarted
Apache - and didn't bother to check.
I should have known better. Glad it's working for you now.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|