Bug Report #2704

Kohana 3 doesn't seem able to talk to MySQL

Added by Brian Kessler almost 5 years ago. Updated over 2 years ago.

Status:ClosedStart date:03/11/2010
Priority:NormalDue date:
Assignee:Woody Gilk% Done:

0%

Category:Modules:Database
Target version:v3.0.4
Resolution:invalid Points:

Description

I've been attempting to follow the tutorial at http://www.dealtaker.com/blog/2010/02/01/kohana-php-3-0-ko3-tutorial-part-4/

This function:

public function getLastTenPosts()
        {
                $sql = 'SELECT *'."\n".
                        'FROM `posts`'."\n".
                        'ORDER BY `id` DESC'."\n".
                        'LIMIT 0,10';

                return $this->_db->query(Database::SELECT, $sql, FALSE)
                         ->as_array();
        }

eventually dies with the following feedback:

ErrorException [ Fatal Error ]: Maximum execution time of 60 seconds exceeded
SYSPATH/classes\kohana\core.php [ 842 ]
837      * respects error_reporting settings.
838      *
839      * @throws  ErrorException
840      * @return  TRUE
841      */
842     public static function error_handler($code, $error, $file = NULL, $line = NULL)
843     {
844         if (error_reporting() & $code)
845         {
846             // This error is not suppressed by current error reporting settings
847             // Convert the error into an ErrorException
{PHP internal call} » Kohana_Core::shutdown_handler()
Environment

This is my database configuration, which I am 100% certain is correct:

'hostname'   => 'localhost',
'port'         => 53336,
'username'   => 'root2',
'password'   => 'fll192ws',
'persistent' => FALSE,
'database'   => 'kohana',

Related issues

Duplicates Kohana v3.x - Bug Report #2701: MySQL/Database config Closed 03/10/2010
Duplicated by Kohana v3.x - Bug Report #2712: Database Bug? Or documentation error? Closed 03/15/2010

History

#1 Updated by Isaiah DeRose-Wilson almost 5 years ago

This doesn't sound like a Kohana issues. Maybe you have an infinite loop in your code some place? It's hard to say without being able to see your code. I suggest you post on the forums if you need help with this.

#2 Updated by Woody Gilk almost 5 years ago

  • Status changed from New to Closed
  • Assignee set to Woody Gilk
  • Target version set to v3.0.4
  • Resolution set to invalid

All of my databases are MySQL, and I can connect just fine.

#3 Updated by Brian Kessler almost 5 years ago

If I replace the return with something like:

return array (
            array (
                     'title' => 'Test 1 - Title',
                     'post'  => 'Test 1 - Post'
                  ),
            array (
                     'title' => 'Test 2 - Title',
                     'post'  => 'Test 2 - Post'
                  ),
             );

The code "works" fine in the sense that the controller calls this function and passes the results to the view for rendering to the browser.

Aside from the specific details of my database, and that I have located my Kohana3 files outside my public directory, my code is the same as provided in the above referenced tutorial.

The only loops in my code are these:


        <?php // In 'templates/default.php'
                foreach($styles as $file=>$type) 
                    {echo HTML::style($file, array('media' => $type)), "\n"; }
        ?>
        <?php 
                foreach($scripts as $file) 
                    { echo HTML::script($file), "\n"; }
        ?>
<?php  // In 'pages/posts.php'
       foreach($posts as $post): ?>
    <h1><?php echo $post['title']; ?></h1>
    <?php echo $post['post']; ?>
    <hr />
<?php endforeach;?>

If it is of any significance, I am using a slightly older version of MySQL:
mysql Ver 14.12 Distrib 5.0.51a, for Win32 (ia32)

[MySQL 5.1 has (or at least had) a known issue where you couldn't reinstall after uninstalling it... I could try updating to 5.5 if you think that might help.]

Can you suggest any simple test to verify that my Kohana installation is talking to my MySQL installation correctly?

#4 Updated by Brian Kessler almost 5 years ago

Updated MySQL to 5.5, but the code still doesn't work.

Will repost to a forum for whatever it's worth.

#5 Updated by Brian Kessler almost 5 years ago

  • Status changed from Closed to Feedback

Issue resolved, thanks to themusicman, see:

http://forum.kohanaphp.com/comments.php?DiscussionID=5105&page=1#Comment_36247

It seems "The code that connects to the db does not even use the port".

#6 Updated by Isaiah DeRose-Wilson almost 5 years ago

Brian, that issue was fixed in #2701.

#7 Updated by Brian Kessler almost 5 years ago

Isaiah DeRose-Wilson wrote:

Brian, that issue was fixed in #2701.

Interesting how only 16 hours ago "This doesn't sound like a Kohana issues. "

But never mind, overall Kohana seems to be a great product and I look forward to learning to make the most of it.

#8 Updated by Anonymous almost 5 years ago

Status should be Closed.

#9 Updated by Woody Gilk almost 5 years ago

  • Status changed from Feedback to Closed

Brian, The change was a comment, not a bug in the code.

#10 Updated by Brian Kessler almost 5 years ago

  • Status changed from Closed to Feedback

If you are having problems communicating clearly to those using your products, including misleading comments within the source code which developers will be reading to configure their installation of your product, I would not dismiss this as "not a Kohana issue".

As someone who might use your product for a professional project, I would assert that anything which stands between me and the successful implementation of Kohana is in fact a Kohana issue.

You do realize that the #1 complaint I see posted against Kohana is the lack of good documentation?

As a sometime professional tech writer, I realize tech writing is not fun and sexy, but unfortunately its something that needs to be done. Unfortunately, I'm not in a position where I can offer to do it pro bono. But if you have any sort of budget for development and would like to see wider adoption of your product, I'd strongly recommend you putting some of your budget into that direction.

#11 Updated by Isaiah DeRose-Wilson almost 5 years ago

  • Status changed from Feedback to Closed

Brian Kessler wrote:

If you are having problems communicating clearly to those using your products, including misleading comments within the source code which developers will be reading to configure their installation of your product, I would not dismiss this as "not a Kohana issue".

I'm sorry, I didn't mean to offend you by saying it wasn't a Kohana issue. It didn't sound like a Kohana issue to me because I've connected to mysql databases hundreds of times without any issues. However I was wrong, it was a Kohana issues and it has been fixed so nobody else will be confused.

#12 Updated by farijon farijon over 2 years ago

I love spam.

Also available in: Atom PDF