Visual Phonebook with database

Im trying to make my fop2 version 2.26 use phonebook with my database in a non pbx installation

I activated
define('DEBUG',true); in config.php

when i go to:
http://X.X.X.X/fop2/phonebook.php

i get :
\"\']+)\s*$/",$line,$matches)) { $conf[ $matches[1] ] = trim($matches[2]); } } } else { die("
".sprintf("Missing or unreadable config file (%s)...cannot continue", $filename)."
"); } return $conf; } ?> You do not have permissions to access this resource.

Comments

  • At the top of config.php you can define a mysql user, password and database. You have to create that database and populate it with the tables found in the mysql-tables.db file in the web directory. Once that is done, everything will work. You do not need to modify php files, just create the database and set the proper credentials at the top of config.php

    Best regards,
  • I populated my database with the mysql.db from the fop2 web directory and set config.php mysql user, password and database.

    when i go to:
    http://X.X.X.X/fop2/phonebook.php

    i still get this error:
    \"\']+)\s*$/",$line,$matches)) { $conf[ $matches[1] ] = trim($matches[2]); } } } else { die("
    ".sprintf("Missing or unreadable config file (%s)...cannot continue", $filename)."
    "); } return $conf; } ?> You do not have permissions to access this resource.

    when i go in my fop2 web interface and click on phonebook it won't open it just kept loading.
  • An error should not display php code,... what fop2 version do you have? how does the first two lines of phonebook.php look like?
  • Im using version 2.26 and the first 2 line of phonebook.php look like this
    <?php
    header("Content-Type: text/html; charset=utf-8");
    require_once("config.php");
    ?>
    and those are the one for config.php

    <?
    // Database connection details
    //
    // Only needed if you do not use FreePBX or want to specify
    // a different database than the freepbx one.

    $DBHOST = 'localhost';
    $DBNAME = 'fop2';
    $DBUSER = 'XXX';
    $DBPASS = 'XXXXXXX';
  • config.php

    <?php
    // Database connection details
    //
    // Only needed if you do not use FreePBX or want to specify
    // a different database than the freepbx one.
    added php but now i getting this
    notice
    /var/www/fop2/lib/dblib.php (line 234)

    mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
    notice
    /var/www/fop2/lib/dbgrid.php (line 1020)

    Function split() is deprecated
    notice
    /var/www/fop2/lib/dbgrid.php (line 1020)

    Function split() is deprecated
    Add Delete Marked Export Import Search

    First Name Last Name Phone 1 Phone 2 Company Picture
    No records found
    «‹1 ›»
    Page : 1 of 0 . Total records found: 0
  • Im using version 2.26 and the first 2 line of phonebook.php look like this


    $DBHOST = 'localhost';
    $DBNAME = 'fop2';
    $DBUSER = 'XXX';
    $DBPASS = 'XXXXXXX';

    Are you sure the above data is correct? can you connect to it with the mysql command line client:
    mysql -u XXX -pXXXXXXX -h localhost fop2
    
  • yes im able to connect to mysql database fop2 with the command.

    mysql -u XXX -pXXXXXXX -h localhost fop2

    PHP 5.4.7 (cli) (built: Sep 14 2012 14:44:02)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    root@SIP:/var/www/fop2/lib# mysql -u XXX -pXXXXXX fop2 -e "desc visual_phonebook"
    +
    +
    +
    +
    +
    +
    +
    | Field | Type | Null | Key | Default | Extra |
    +
    +
    +
    +
    +
    +
    +
    | id | int(11) | NO | PRI | NULL | auto_increment |
    | firstname | varchar(50) | YES | MUL | NULL | |
    | lastname | varchar(50) | YES | | NULL | |
    | company | varchar(100) | YES | | NULL | |
    | phone1 | varchar(50) | YES | | NULL | |
    | phone2 | varchar(50) | YES | | NULL | |
    | owner | varchar(50) | YES | | | |
    | private | enum('yes','no') | YES | | no | |
    | picture | varchar(100) | YES | | NULL | |
    | context | varchar(150) | YES | | | |
    +
    +
    +
    +
    +
    +
    +
  • You are seeing unparsed php code in phonebook.php, be sure the php is interpreted correctly, there is a missing opening php tag , or some error of that sort.
  • I think I blew away my correct permissions for visual_phonebook
    re-applied these
    grant all privileges on *.* to 'root'@'%' with grant option;
    grant all privileges on *.* to 'root'@'localhost' with grant option;
    flush privileges;
    restarted db
    have 4900+ entries, and can see only the 2 that I have manually entered from gui
    I can see the 2 from the command line as well
    mysql -u root -pfakenew-password -h localhost fop2 -e "show tables"
    this command works fine
    any suggestions

    ver 2.29.01


Sign In or Register to comment.