The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. February 12, 2012, 12:37:38 AM

Login with username, password and session length


Pages: [1] 2 3 4
  Print  
Author Topic: can't get buildsql.php to work  (Read 8137 times)
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« on: September 05, 2008, 07:13:53 AM »

hello,

i'm trying to work with phpMyIDE.  I have downloaded the scripts and uploaded them to my web server.  the server name is:

live url removed for member safety

(I expect that it will create some tables that begin with 'pmi_'.  However, no tables are created.)

my mySQL version is 5.0.51-log.  the PHP version that i'm running is 5.16.  The version of my phpMyAdmin is 2.11.8.1

I've asked my hosting company for help in configuring the config.php file.  They gave me a couple of responses before suggesting that I ask the vendor for help.

Is it possible for someone to give me some help in getting started with phpMyIDE?

thanks,

Scott
« Last Edit: September 05, 2008, 08:37:01 AM by perkiset » Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #1 on: September 05, 2008, 08:47:46 AM »

Hey Scott -

First off, welcome to The Cache and thanks for trying phpMyIDE. Sorry about editing your first post and removing the live link - but some of the folks who lurk here are, well, very interested in the security of sites or lack thereof and I'd hate for someone to have their way with you Wink

Have you looked at the config.php file? You'll need to set that up *before* you run buildsql.php. There are two areas you'll need to address in the config.php file. The top area are sort of "global setup" variables that define the way (your) phpMyIDE will run. The second is down at the bottom, where you need to define connections that will be available for phpMyIDE. The globals are more about how phpMyIDE runs, the connections are how it connects to databases. If connection 0 (at the bottom of the file) is not correctly set up, then phpMyIDE will not be able to talk to your database and create the tables you need.

The best way to see how things are shaping up is to run the command testinstall.php. Do this by calling the file just like you were for buildsql.php. This will send back a little page telling you about how phpMyIDE is running and connected. If all is OK, you should see several lines that say "OK" and no complaints.

Hope that nudges you in the right direction... ping back if you need more.

Good luck and thanks again!
/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #2 on: September 05, 2008, 09:11:16 AM »

hi Perkiset,

Actually, thanks for editing my post.

Yes, I've looked all over the config.php file.  I've spent a lot of time with it, actually.

I ran the testinstall.php script and it reports:

Testing Includes
OKTesting: config.php
OKTesting: source/class.dbconnection.php
OKTesting: source/class.webrequest2.php

Testing Functions
Not AvailableTesting: json_encode
Not AvailableTesting: json_decode
OKTesting: mysql_connect
Not AvailableTesting: mysqli_connect

Error: Connections and Privileges not tested


Does this feedback provide a hint as to what is wrong?

thanks,

Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #3 on: September 05, 2008, 12:13:02 PM »

Absolutely.

first, json_encode and json_decode are required functions for the system to work. It sounds like your ISP is on an older version of PHP ... please post what version you have and I can tell you where to go from there.

the mysqli_ problem is the same... your ISP's instance of PHP was not compiled with support for the new mysqli_ functions, which are also required. It is as simple in this case as them --enable-mysqli on the box, provided they have a reasonably recent version of PHP on it...

Note that in the response you sent me, your connections have not even been checked yet, since some fundamental pieces are not available to you yet.

Ping back as you move on... I'll be out with clients for the next few hours, I can respond later today though.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #4 on: September 08, 2008, 07:06:46 PM »

hi Perkiset,

thanks for the help so far.  i've been using your comments with my hosting company to try to move forward.

when i run the test script (testinstall.php), i get this output:

produces this output:

Testing Includes
OKTesting: config.php
OKTesting: source/class.dbconnection.php
OKTesting: source/class.webrequest2.php

Testing Functions
Not AvailableTesting: json_encode
Not AvailableTesting: json_decode
OKTesting: mysql_connect
OKTesting: mysqli_connect

meanwhile, my hosting company gave me a PHP.ini file.  is there some common flag that goes in a PHP.ini that enables json_encode/json_decode?  Also, what version of PHP do I need for these functions to work?  (I think I have 5.0.51-log)

your help is appreciated.

thanks,
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #5 on: September 08, 2008, 09:39:03 PM »

json_encode/decode is double extra critical to the package. As of about PHP 5 it was included by default. Before that, it needed to be installed as a PECL package - the documentation for it is here: http://us2.php.net/manual/en/book.json.php

It might seem a little creepy at first, and if you're not comfortable getting to an SSH shell and dinking about, then you may be in a bit of a bind. This is a *wholly reasonable* feature for you to ask for, and in fact, it's a bit of an oversight on their part that they didn't include it at the get go.

It looks like they have the mysqli_ functions enabled, so they have a reasonably recent version of PHP running... it is a bit beyond me why they would forget the json functions unless they just never get asked for them.

The way you say this, "I think I have 5.0.51" sounds almost like you have your own VPS or dedicated server... are you doing shared hosting or is this your own dedicated box? If it if all yours, then the fix is a snap. Well, somewhat a snap, depends on how good you are with the shell again - but there's plenty folks here (myself included) that can assist.

Good luck with your ISP and let us know how it turns out,
/perk
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #6 on: September 11, 2008, 04:31:49 AM »

hi Perkiset,

I appreciate the help so far.  My hosting company upgraded my version of MySQL.  When I run the testinstall.php this is my output:

Testing Includes

Testing: config.php OK
Testing: source/class.dbconnection.php OK
Testing: source/class.webrequest2.php OK

Testing Functions
Testing: json_encode OK
Testing: json_decode OK
Testing: mysql_connect OK
Testing: mysqli_connect OK

Testing Prompt Handler
Testing: Connection OK

Testing Connections
Testing: Writeable current-connection OK
Testing: mbcrazy mySQL OK

Testing Privileges
Testing: mbcrazy mySQL
show procedure status OK
drop procedure OK
create procedure OK
Error in my_thread_global_end(): 2 threads didn't exit


--the last statement suggests there remains another problem.  Also, when I attempt to run the buildsql.php, no tables created.   (The first time I run buildsql, nothing displays on the browser.  The second time I get this error: Error in my_thread_global_end(): 1 threads didn't exit.)

Do you have any ideas how to solve the my_thread_global_end() problem?

thanks,
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #7 on: September 11, 2008, 11:11:20 AM »

Wow that's a new one... and not my error at all.

First off, the very last thing that script tests is drop and create procedures, and it reports "create procedure OK" (which you have) as about the very last thing it does. There's nothing else of any significance to that script. So according to what I know, your system has passed all the tests I need for phpMyIDE to run. I'd be interested now to see if the essential components of phpMyIDE work for you since you got through the "connections" portion of testing, which is one of the most vital.

The error you're seeing is a MySQL error, but seems to have something to do with the interaction of the versions of MySQL and PHP running on your box. There's a fairly long, but not completely helpful thread about it at the MySQL forum here:

http://forums.mysql.com/read.php?10,153077,153077#msg-153077

There are several different ways that people had tackled that issue, but for the most part it's a daemon version problem and again, you'll need to get your ISP involved because this is almost certainly beyond your capabilities - unless this is a dedi or CoLo box. Please walk that thread and see if any of the scenarios pertain to you... perhaps there's an immediate answer in there for you.

Sorry that I cannot directly help on this one, but hope this bumps you in the right direction. IMPORTANT NOTE: This problem is systemic and will mess with lots of things other than phpMyIDE - it is important that you resolve it irrespective of your using phpMyIDE.
« Last Edit: September 11, 2008, 11:13:03 AM by perkiset » Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5604


Back in my day we had 9 planets


View Profile
« Reply #8 on: September 11, 2008, 01:14:57 PM »

where are you hosting if i might ask?
is it a single box? a grid? a shared?

mostly just curious.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #9 on: September 11, 2008, 06:29:53 PM »

hi nutballs,

my site is on shared hosting from a hosting company (i.e., I don't host it myself).


Logged
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #10 on: September 11, 2008, 06:37:38 PM »

hi Perkiset,

I appreciate your help.  The hosting company did the old trick of using the previous version's library DLL and the testinstall.php now reports no errors.  However, the build script still unfortunately doesn't do anything.

Here's the test script's output:

Testing Includes
Testing: config.php OK
Testing: source/class.dbconnection.php OK
Testing: source/class.webrequest2.php OK

Testing Functions
Testing: json_encode OK
Testing: json_decode OK
Testing: mysql_connect OK
Testing: mysqli_connect OK

Testing Prompt Handler
Testing: Connection OK

Testing Connections
Testing: Writeable current-connection OK
Testing: mbcrazy mySQL OK

Testing Privileges
Testing: mbcrazy mySQL OK
show procedure status OK
drop procedure OK
create procedure OK

Every test shows "OK" as a result.  However, when i run buildsql.php in a browser I see nothing but white space on the browser.  When i look at the database using phpAdmin, I see no new tables added.

(btw, does the buildsql.php show some kind of status message indicating that it has done something?  It would be nice to have some kind of message appear.)

if you have any more ideas i'd love to hear them.  I've been looking forward to migrating my database out of the MSSQL Hell for so long; it would be bittersweet to think i'm going to be stuck with MSSQL for a few months longer.

Thanks for all the help so far.  You've provided us with a lot of valuable information.

Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #11 on: September 11, 2008, 07:47:17 PM »

OK, the test install looks good.

I don't know why you're not getting anything from the script at all - you should be getting some responses as the SQL is built. However, since there are no tables built after you run the script, clearly there's something wrong. (BTW, these tables can be built manually - there may be troubles with the install script for you, but that's hardly a reason to not use the IDE)

This is a modified script I'd like you to run and tell me what you get. It's just going to dump more information to the screen. If you get nothing at all, that will tell us something as well.

Code:
<?php

echo "<pre>";
echo 
"Starting buildSQL.php\n";
error_reporting(E_ALL);

require 
'config.php';
echo 
"Config.php installed\n";

$my = new mysqli($connections[0]['host'], $connections[0]['user'], $connections[0]['password']);
echo 
"MySQLi Resource Handle: [$my]\n";

$sql = <<<SQL
DROP TABLE IF EXISTS {$pmiDBPrefix}long_commands;
CREATE TABLE IF NOT EXISTS 
{$pmiDBPrefix}long_commands (
  datestamp date NOT NULL,
  id int(11) NOT NULL auto_increment,
  command text NOT NULL,
  PRIMARY KEY  (datestamp,id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
select "Built long_commands";

DROP TABLE IF EXISTS 
{$pmiDBPrefix}long_responses;
CREATE TABLE IF NOT EXISTS 
{$pmiDBPrefix}long_responses (
  command_datestamp date NOT NULL,
  command_id int(11) NOT NULL,
  id int(11) NOT NULL auto_increment,
  response text NOT NULL,
  PRIMARY KEY  (command_datestamp,command_id,id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
select "Built long_responses";

DROP TABLE IF EXISTS 
{$pmiDBPrefix}preferences;
CREATE TABLE IF NOT EXISTS 
{$pmiDBPrefix}preferences (
  name varchar(32) NOT NULL,
  value varchar(254) NOT NULL,
  PRIMARY KEY  (name)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
select "Built preferences";

INSERT INTO 
{$pmiDBPrefix}preferences (name, value) VALUES ('print_headertitle', '1'),
('print_pagenumbers', '1'),
('print_headerdate', '1'),
('print_linenumbers', '1'),
('print_fontsize', '11'),
('print_fontname', 'courier');
select "Installed preferences";

DROP TABLE IF EXISTS 
{$pmiDBPrefix}timemachine;
CREATE TABLE IF NOT EXISTS 
{$pmiDBPrefix}timemachine (
  descriptor varchar(254) NOT NULL,
  uid int(11) NOT NULL auto_increment,
  timestamp datetime NOT NULL,
  createsql text NOT NULL,
  PRIMARY KEY  (descriptor,uid)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
select "Built timemachine";

DROP TABLE IF EXISTS 
{$pmiDBPrefix}triggers;
CREATE TABLE IF NOT EXISTS 
{$pmiDBPrefix}triggers (
  dbname varchar(128) NOT NULL,
  tablename varchar(64) NOT NULL,
  timing varchar(32) NOT NULL,
  oneshot char(1) NOT NULL default '0',
  script text NOT NULL,
  PRIMARY KEY  (dbname,tablename,timing)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
select "Built triggers";
select "All Done";
SQL;

echo 
"About to throw this SQL:\n";
echo 
"$sql\n";

if(
$my->multi_query($sql))
{
echo "Query Executed\n";
do 
{
if ($res $my->store_result())
{
echo "Store Result Succeeded\n";
$row $res->fetch_row();
echo "{$row[0]}\n";
$res->close();
} else {
echo "Store Result Failed\n";
echo "Error (1): {$my->error}\n";
}
} while($my->next_result());
} else {
echo "Query did not execute\n";
echo "Error (0): {$my->error}\n";
}

echo 
"Process Completed\n";
echo 
"</pre>";

?>



Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #12 on: September 12, 2008, 04:33:50 AM »

Perkiset,

once again thanks for your attention in this manner.  I'm grateful for your assistance.

I named the script buildsql2.php.  When I run it it produces this output:
 
  * * *

Starting buildSQL.php
Config.php installed

Catchable fatal error:  Object of class mysqli could not be converted to string in buildsql2.php on line 11.

(The error actually displays the full path of the script; i took it out for privacy reasons.)

Although I'm not very knowledgeable about php, it seems to have a problem with this statement:

$my = new mysqli($connections[0]['host'], $connections[0]['user'], $connections[0]['password']);


thanks again for the help.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #13 on: September 12, 2008, 08:45:23 AM »

Nope, that's my bad - usually resource handles are just integers. It seems, in this case, that the resource handle is something that PHP cannot convert to a string to display in the debugging line right after the one you mention.

We're gonna have to play through this one... please change the line

echo "MySQLi Resource Handle: [$my]\n";

to

if ($my) echo "Have Handle\n";
else die("No Handle\n");

... I think that will do it. Let's see what we get!
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
cafescott
Rookie
**
Offline Offline

Posts: 34


View Profile
« Reply #14 on: September 12, 2008, 02:57:26 PM »

Perkiset,

There's another error.  Here's the output:

Starting buildSQL.php
Config.php installed

Catchable fatal error:  Object of class mysqli could not be converted to string in .......\buildsql2.php on line 11


Here's a chunk of source code with line numbers in front of them:

[7] require 'config.php';
[8] echo "Config.php installed\n";
[9]
[10] $my = new mysqli($connections[0]['host'], $connections[0]['user'], $connections[0]['password']);
[11] echo "MySQLi Resource Handle: [$my]\n";
[12] if ($my) echo "Have Handle\n";
[13] else die("No Handle\n");
[14] $sql = <<<SQL

looks like the echo "MySQLi" line is faulty.  I appreciate your help.

thanks,

Logged
Pages: [1] 2 3 4
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!