Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:28:55+00:00 2026-05-24T04:28:55+00:00

I have a problem with my application’s model. it should save a new user

  • 0

I have a problem with my application’s model. it should save a new user in a mysql database.

application/config/application.ini

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.params.displayExceptions = 1
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "pass"
resources.db.params.dbname = "cms"
resources.db.isDefaultTableAdapter = true

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

application/controllers/MemberController.php:

public function newAction()
{
    $frmNewMember = new Form_MemberRegisterationForm();
    $frmNewMember->setMethod('post');
    $frmNewMember->setAction('/member/new');
    if ($this->getRequest()->isPost())
    {
        if ($frmNewMember->isValid($_POST))
        {
            $memberModel = new Model_Members();
            // process the data
            $result = true;
            $result = $memberModel->createMember(
                $frmNewMember->getValue('name'), 
                $frmNewMember->getValue('lastName'), 
                $frmNewMember->getValue('uid'), 
                $frmNewMember->getValue('email'), 
                $frmNewMember->getValue('password'));
            if ($result)
            {
                $this->_forward('confirm');
            }
        }
    }
    $this->view->form = $frmNewMember;
}

application/models/Members.php:

public function createMember($name, $lastName, $uid, $email, $password)
{
    // Create row data
    $row = $this->createRow();
    $row->name = $name;
    $row->lastName = $lastName;
    $row->uid = $uid;
    $row->email = $email;
    $row->pasword = md5($password);
    // Save the row
    $row->save();
    $id = $this->_db->lastInsertId();
    return $id;
}

When I click on send button this error occures:

Fatal error: Undefined class constant 'EXCEPTION_NO_ROUTE' 
in /var/www/project/application/controllers/ErrorController.php on line 11

I know the problem is about $row = $this->createRow(); code. because when I replace whole createMember method’s body with return $true there is no error.

UPDATE:

this is my _initAutoload() in the Bootsreap.php. should I add something to configure database?

protected function _initAutoload()
{
    // Add autoloader empty namespace
    $autoLoader = Zend_Loader_Autoloader::getInstance();
    $autoLoader->registerNamespace('CMS_');
    $resourceLoader = new Zend_Loader_Autoloader_Resource(
        array ('basePath' => APPLICATION_PATH, 'namespace' => '', 
            'resourceTypes' => array (
                'form' => array ('path' => 'forms/', 
                    'namespace' => 'Form_' ), 
                'model' => array ('path' => 'models/', 
                    'namespace' => 'Model_' ) ) ));
    // Return it so that it can be stored by the bootstrap
    return $autoLoader;
}

2nd UPDATE:
The exception thrown is:

exception ‘Zend_Db_Adapter_Exception’ with message ‘SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)’ in /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Pdo/Abstract.php:138 Stack trace: #0 /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Abstract.php(444): Zend_Db_Adapter_Pdo_Mysql->_connect() #2 /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Pdo/Abstract.php(232): Zend_Db_Adapter_Abstract->query(‘DESCRIBE cms….’, Array) #3 /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Pdo/Mysql.php(156): Zend_Db_Adapter_Pdo_Abstract->query(‘DESCRIBE cms….’) #4 /usr/local/zend/share/ZendFramework/library/Zend/Db/Table/Abstract.php(727): Zend_Db_Adapter_Pdo_Mysql->describeTable(‘members’, ‘cms’) #5 /usr/local/zend/share/ZendFramework/library/Zend/Db/Table/Abstract.php(753): Zend_Db_Table_Abstract->_setupMetadata() #6 /usr/local/zend/share/ZendFramework/library/Zend/Db/Table/Abstract.php(1297): Zend_Db_Table_Abstract->_getCols() #7 /var/www/project/application/models/Members.php(33): Zend_Db_Table_Abstract->createRow(Array, NULL, true) #8 /var/www/project/application/controllers/MemberController.php(32): Model_Members->createMember(‘1’, ‘1’, ‘1’, ‘soroush.rabiei@…’, NULL) #9 /usr/local/zend/share/ZendFramework/library/Zend/Controller/Action.php(512): MemberController->newAction() #10 /usr/local/zend/share/ZendFramework/library/Zend/Controller/Dispatcher/Standard.php(288): Zend_Controller_Action->dispatch(‘newAction’) #11 /usr/local/zend/share/ZendFramework/library/Zend/Controller/Front.php(945): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #12 /usr/local/zend/share/ZendFramework/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front->dispatch() #13 /usr/local/zend/share/ZendFramework/library/Zend/Application.php(328): Zend_Application_Bootstrap_Bootstrap->run() #14 /var/www/project/public/index.php(26): Zend_Application->run() #15 {main}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:28:57+00:00Added an answer on May 24, 2026 at 4:28 am

    The exception message is quite clear :

    exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)' in /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Pdo/Abstract.php:138
    

    This means that your DB driver tries to connect to mysql via a socket located in /tmp/mysql.sock on your server, but does not find it.

    You have 3 options :

    • configure your mysql server (through my.cnf) to put it’s socket in /tmp. This option should be used carefully as it has an impact on all applications using the same mysql instance
    • find where mysql puts it’s socket, and edit your php.ini to point to that socket. This option must be used carefully too, because it has an impact on every php application used on the server

    Example :
    ; under the [Pdo_mysql] section of the php.ini
    pdo_mysql.default_socket=/mysql.sock

    • Configure your application to connect through a socket. That’s a PDO option, and it should be passed to your Zend_Db_Adapter constructor, as described in the example #7 of this page.

    The option is named unix_socket and is described in the PDO DSN php.net doc page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem in a Windows Forms application with Bitmap.Save failing when I
I again have problem with routing :) When I run application if user is
I have a problem with my application where the user will open more than
I have problem with my application. I have table report, there are 2 column
I have a problem with an application which uses the same stored procedure over
I have a problem linking an application for an embedded target. I'm developing on
I have problem concerning python packages and testing. I'm writing an application using wx
I have a problem with a little .Net web application which uses the Amazon
I have a problem with an ASP.NET application that is driving me nuts. When
I have a problem with a Winforms application written in Visual Studio 2005 (C#).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.