another "error while connecting to database:"

Please post all install related problems here. Visit this forum first for troubleshooting.
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

another "error while connecting to database:"

Post by raven »

well it seems that many people have this problem but still can't understand how to fix it.

I have appserv 2.5.6 installed with the following components:
# Apache Web Server Version 2.2.2
# PHP Script Language Version 5.1.4
# MySQL Database Version 5.0.22
# phpMyAdmin Database Manager Version 2.8.2

everything is running ok but...

installed phpwcms ver. 1.2.6
phpwcms creates the tables in the database during the setup process but..

it cannot create the webmaster user --> i created it manually using the instructions in this board.

i cannot create a new article (the "error while connecting to database:" message) although I can create new templates and add pages to the site structure.

i deleted everything and reinstalled but the same happened again.
(i delete the database and the database user just to be sure!)

i just installed phpwcms 1.2.7 but have the same problems.

It seems my configurations is not 100% ok but joomla and others work flawlessly.

HELP! :(
Pappnase

Post by Pappnase »

hello

please post your conf.inc.php without usernames and passwords.
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

goodmorning.

Here is my conf.inc.php

Code: Select all

<?php

// database values
$phpwcms["db_host"]           = "localhost";
$phpwcms["db_user"]           = "*******";
$phpwcms["db_pass"]           = "*******";
$phpwcms["db_table"]          = "wcms_db";
$phpwcms["db_prepend"]        = "";
$phpwcms["db_pers"]           = 1;

// site values
$phpwcms["site"]              = "http://localhost/";
$phpwcms["admin_email"]       = "info@mail.com";

// paths
$phpwcms["DOC_ROOT"]          = $_SERVER['DOCUMENT_ROOT'];
$phpwcms["root"]         		= "mywcms";         //default: ""
$phpwcms["file_path"]         = "phpwcms_filestorage";    //default: "phpwcms_filestorage"
$phpwcms["templates"]         = "phpwcms_template";    //default: "phpwcms_template"
$phpwcms["content_path"]      = "content"; //default: "content"
$phpwcms["cimage_path"]       = "images";  //default: "images"
$phpwcms["ftp_path"]          = "phpwcms_ftp";     //default: "phpwcms_ftp"

// content values
$phpwcms["file_maxsize"]      = 2097152; //Bytes (50 x 1024 x 1024)
$phpwcms["content_width"]     = 538; //max width of the article content column - important for rendering multi column images
$phpwcms["img_list_width"]    = 100; //max with of the list thumbnail image
$phpwcms["img_list_height"]   = 75; //max height of the list thumbnail image
$phpwcms["img_prev_width"]    = 538; //max width of the large preview image
$phpwcms["img_prev_height"]   = 400; //max height of the large preview image
$phpwcms["max_time"]          = 1800; //logout after max_time/60 seconds

// other stuff
$phpwcms["compress_page"]     = 0; //0 = OFF, 1-9: page compression ON (1 = low level, 9 = highest level)
$phpwcms["imagick"]           = 0; //0 = GD,  1 = ImageMagick, 2 = ImageMagick 4.2.9
$phpwcms["imagick_path"]      = ""; //Path to ImageMagick (default="" - none)
$phpwcms["use_gd2"]           = 1; //0 = GD1, 1 = GD2
$phpwcms["rewrite_url"]       = 0;  //whether URL should be rewritable
$phpwcms["wysiwyg_editor"]    = 2;  //0 = no wysiwyg editor, 2 = FCKeditor, 4 = spaw
$phpwcms["phpmyadmin"]        = 0;  //enable/disable phpMyAdmin in Backend
$phpwcms["default_lang"]      = "en";  //default language
$phpwcms["charset"]           = "";  //default charset 'iso-8859-1'
$phpwcms["allow_remote_URL"]  = 0;  //0 = no remote URL in {PHP:...} replacement tag allowed, 1 = allowed
$phpwcms["gt_mod"]            = 0;  //0 = Graphical Text MOD disabled, 1 = enabled
$phpwcms["jpg_quality"]       = 75; //JPG Quality Range 25-100
$phpwcms["sharpen_level"]     = 1;  //Sharpen Level - only ImageMagick: 0, 1, 2, 3, 4, 5 -- 0 = no, 5 = extra sharp
$phpwcms["allow_ext_init"]    = 1;  //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"]  = 1;  //allow including of custom external scripts at frontend rendering
$phpwcms["cache_enabled"]     = 0;        //cache On/Off - 1 = caching On / 0 = caching Off (default)
$phpwcms["cache_timeout"]     = 0;  //default cache timeout setting in seconds - 0 = caching Off
$phpwcms["imgext_disabled"]   = '';  //comma seperated list of imagetypes which should not be handled "pdf,ps"
$phpwcms["multimedia_ext"]    = 'aif,aiff,mov,movie,mp3,mpeg,mpeg4,mpeg2,wav,swf,swc,ram,ra,wma,wmv,avi,au,midi,moov,rm,rpm,mid,midi'; //comma seperated list of file extensiosn allowed for multimedia
$phpwcms["inline_download"]   = 1;  //1 = try to display download documents in new window; 0 = show safe under dialog
$phpwcms["form_tracking"]     = 1; //make a db entry for each form
$phpwcms["formmailer_set"]    = array('allow_send_copy' => 0, 'global_recipient_email' => 'form@localhost'); //for better security handling
$phpwcms["allow_cntPHP_rt"]   = 0; //allow PHP replacement tags and includes in content parts
$phpwcms["GETparameterName"]  = 'id'; //must have a minimum of 2 chars 

// dynamic ssl encryption engine
$phpwcms["site_ssl_mode"]     = '0'; // tuns the SSL Support of WCMS on(1) or off (0) DEFAULT '0'
$phpwcms["site_ssl_url"]      = '';  //URL assigned to the SSL Certificate. DON'T add a slash at the End! Exp. "https://www.yourdomainhere.tld"
$phpwcms["site_ssl_port"]     = '443'; //The Port on which you SSL Service serve the secure Sites. Servers DEFAULT is '443'

// smtp values
$phpwcms['SMTP_FROM_EMAIL']   = 'info@mail.com'; // reply/from email address
$phpwcms['SMTP_FROM_NAME']    = 'phpwcms webmaster'; // reply/from name
$phpwcms['SMTP_HOST']         = 'localhost'; // SMTP server (host/IP)
$phpwcms['SMTP_PORT']         = 25; // SMTP-Server port (default 25)
$phpwcms['SMTP_MAILER']       = 'mail'; // default phpMailer: smtp, mail (default), sendmail
$phpwcms['SMTP_AUTH']         = 0; // sets SMTP_AUTH to ON/OFF
$phpwcms['SMTP_USER']         = ''; // default SMTP login (user) name
$phpwcms['SMTP_PASS']         = ''; // default SMTP password


// Try to check and uncomment the DOCUMENT_ROOT if you have problems 
// often neccessary on IIS or default MacOS X webserver settings
// Do not use backslash "\" on Windows - always replace "\" by "/"
//$_SERVER['DOCUMENT_ROOT']     = 'C:/Internet/AppServ/www';


?>
thanx for your prompt answer!
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

check the Permissions of the Database User.

try followin changes if possible

use a real URL in $phpwcms["db_host"] like db.host.tld or the IP of the Server

use a Tablename without underscore $phpwcms["db_table"] = "wcmsdb";

set this to $phpwcms["db_pers"] = 0;

just some Ideas - had never this Problems
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Re: another "error while connecting to database:"

Post by DeXXus »

Welcome Raven!

You could also try:

Code: Select all

// site values
$phpwcms["site"]            = "http://".$_SERVER['SERVER_NAME']."/";
This sounds "unusual"! And you claim it happens with multiple different versions? Hmm, are you leaving this to the "default" webmaster account name and password?
(You can change it later, when things get up and running.)
raven wrote:but..

it cannot create the webmaster user --> i created it manually using the instructions in this board.
Could you turn on all warnings, notices and errors in PHP.INI for a little bit... to see if other "amplifying" messages are shown? And could you paste the "actual" text of some "representative" error messages? Thanks!
raven wrote:i cannot create a new article (the "error while connecting to database:" message) although I can create new templates and add pages to the site structure.
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

hello again.

Code: Select all

Notice: Undefined variable: article_err in C:\Internet\AppServ\www\mywcms\include\inc_tmpl\article.new.tmpl.php on line 105
error while connecting to database:

INSERT INTO phpwcms_article (article_cid, article_uid, article_username, article_title, article_keyword, article_public, article_aktiv, article_begin, article_end, article_subtitle, article_redirect, article_sort, article_notitle, article_created, article_cache, article_nosearch, article_nositemap, article_aliasid, article_headerdata, article_morelink) VALUES ('0','1','webmaster','Testing the Test','','1','1','2006-07-19 15:38:39','2010-12-31 23:59:59','','', 0,0, '1153312719', '', '', 1, 0, 0, 1);

here is the error from PHP (enabled all errors). Although I haven't made the changes that pico and DeXXus suggested.

since this is a test setup on a pc with a dynamic Ip changing the localhost to something else would be a bit pointless.

I did a clean install with all PHP errors enabled (but did not get any php ERROR during Setup only standard errors from installation) so here is more info:
creating a new database without "_" didn't make any difference

setup is creating the tables but again it cannot create the webmaster user! (default settings used).

in step 4 i get the following warning from php:

Code: Select all

[19-Jul-2006 16:04:00] PHP Warning:  Cannot modify header information - headers already sent by (output started at C:\Internet\AppServ\www\mywcms\setup\setup.php:147) in C:\Internet\AppServ\www\mywcms\setup\setup.php on line 159
and can't move any further (cause it's a warning!)
no idea why is this happening!

thanx again!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

The "undefined variable" can be ignored, so it looks like the next problem is that phpWCMS cannot connect (or remain connected) to the database. Your mention of "dynamic ip" is likely related (keep in mind that PHP must be kept apprised of any change in IP too ;-) ) so using the Server environment variable that I offered would seem to be okay, I ~think~. Maybe turning off the persistent Db connection would help?

As to the last error, that may be related to parsing the "setup.php" file. Version 1.2.6 is "unique" in that it has MAC-style linebreaks and those (not you) who must use FTP have problems requiring "binary" mode transfer. But you are local, probably just unzipped an archive and kept going, however, it just so happens that line 148 is a blank line with only a "tabbed" linebreak (you can/should just close up the gap between 147 & 149 by deleting that blank line in "setup.php").

Code: Select all

$phpwcms["charset"]          = clean_slweg($_POST["charset"]);
	<-----Line 148
$phpwcms["file_maxsize"]     = ($phpwcms["file_maxsize"]) ? $phpwcms["file_maxsize"] : 2097152;
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

DeXXus wrote:The "undefined variable" can be ignored, so it looks like the next problem is that phpWCMS cannot connect (or remain connected) to the database. Your mention of "dynamic ip" is likely related (keep in mind that PHP must be kept apprised of any change in IP too ;-) ) so using the Server environment variable that I offered would seem to be okay, I ~think~. Maybe turning off the persistent Db connection would help?
ok. I understand your concerns about my "dynamic Ip" but what if this was a server without a network connection and was used in order to be able to build the website in a "isolated" environment!

I turned off the persistend Db Connection option but still had no luck!

setup creates the tables but NOT the webmaster user!



DeXXus wrote: As to the last error, that may be related to parsing the "setup.php" file. Version 1.2.6 is "unique" in that it has MAC-style linebreaks and those (not you) who must use FTP have problems requiring "binary" mode transfer. But you are local, probably just unzipped an archive and kept going, however, it just so happens that line 148 is a blank line with only a "tabbed" linebreak (you can/should just close up the gap between 147 & 149 by deleting that blank line in "setup.php").

Code: Select all

$phpwcms["charset"]          = clean_slweg($_POST["charset"]);
	<-----Line 148
$phpwcms["file_maxsize"]     = ($phpwcms["file_maxsize"]) ? $phpwcms["file_maxsize"] : 2097152;
as for this error, deleting the blank line fixed it as you suggested.

after i made the new clean install I get the following errors when i visit login.php

Code: Select all

Strict Standards: Assigning the return value of new by reference is deprecated in C:\Internet\AppServ\www\mywcms\login.php on line 73

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Internet\AppServ\www\mywcms\login.php:73) in C:\Internet\AppServ\www\mywcms\login.php on line 24
and when I put my login details i get these:

Code: Select all

Strict Standards: Assigning the return value of new by reference is deprecated in C:\Internet\AppServ\www\mywcms\login.php on line 73

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Internet\AppServ\www\mywcms\login.php:73) in C:\Internet\AppServ\www\mywcms\login.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at C:\Internet\AppServ\www\mywcms\login.php:73) in C:\Internet\AppServ\www\mywcms\include\inc_lib\general.inc.php on line 1165
i used the line

Code: Select all

$phpwcms["site"]            = "http://".$_SERVER['SERVER_NAME']."/";
and the above errors dissapeared.

But still can't create an article! :-(

i had the same problem with version 1.2.7!

:?: :?: :?: :? :? :?
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

Hi raven,

I think, the better way is an installation of Xampp http://www.apachefriends.org/en/xampp.html
XAMPP is a little bit easyer to handle.
Before you do so, please deinstall the appserv.

regards Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

flip-flop wrote:Hi raven,

I think, the better way is an installation of Xampp http://www.apachefriends.org/en/xampp.html
XAMPP is a little bit easyer to handle.
Before you do so, please deinstall the appserv.

regards Knut
I thought of that (downloading the installer), and I hope I'll have better luck.

any more ideas? i'm open to suggestions!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

raven wrote:setup creates the tables but NOT the webmaster user!
raven wrote:But still can't create an article! :-(

i had the same problem with version 1.2.7!

:?: :?: :?: :? :? :?
These two statements are "incompatible" :shock:
How are you logged in and attempting to create an article... if phpWCMS did not create the webmaster user?
Last edited by DeXXus on Wed 19. Jul 2006, 21:28, edited 1 time in total.
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

raven wrote:ok. I understand your concerns about my "dynamic Ip" but what if this was a server without a network connection and was used in order to be able to build the website in a "isolated" environment!
I'm sorry, I did not mean to make any inference that your "dynamic ip" was affecting the installation -or- even the running of your website "locally" (unless your database is on another machine -or- your server's ip changed right in the midst of a DB connection). Actually the "dynamic ip" would only affect access "to" your webserver "from" the outside world -and- affect access "for" your webserver "to" the outside world, anyway, as long as the server and Database are "local"! :wink:

AS it relates to the server running PHP (and subsequently phpWCMS), it seems like it should not matter whether you use "http://localhost/" or "http://127.0.0.1/" or "http://servername/" (local machine only) or "http://".$_SERVER['SERVER_NAME']."/";. If the "install.php" script starts up when you browse to it and begins the process... then $phpwcms["site"] is correct for any of them. :wink: If the database tables are created... then the username/pass and database address are all correct.

Some folks run the latest of everything... some don't. It could be that AppServ's settings for MySQL 5.x -or-Apache's "httpd.conf" -or- .htaccess -or- PHP's "php.ini" files, etc. may have a slight difference -or- be "completely" customized... I don't know. Sometimes "php.ini" is copied to Windows directory... other times it is in the PHP directory. Sometimes you should backup the "php.ini" and copy php_ini_recommended (or whatever) as the new "php.ini".
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

DeXXus wrote:
raven wrote:setup creates the tables but NOT the webmaster user!
raven wrote:But still can't create an article! :-(

i had the same problem with version 1.2.7!

:?: :?: :?: :? :? :?
These two statements are "incompatible" :shock:
How are you logged in and attempting to create an article... if phpWCMS did not create the webmaster user?
I create the user manually as it is described in this forum!

I insert the user in the phpwcms_user table with all the relevant information.
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

still haven't installed XAMPP but a question popped into my mind!

could the "safe mode" status of php, creating this problem? :?: :roll:
raven
Posts: 10
Joined: Tue 18. Jul 2006, 23:44

Post by raven »

HEH...must be an incompatibility with the various versions of servers or the code as DeXXuS originaly said earlier.

phpwcms 1.2.6 & pre1.2.7 works with Xampp 1.5.3 !!!

Thanx for you support & help & time.

p.s. although i would like to understand what was not working well with my previous installation! but for the time being.....Xampp...! :D
Post Reply