dguilloryjr Posted April 28, 2007 Share Posted April 28, 2007 I am setting up a dev site on our server, this is my 1st time working with linux, so i got the cpanel control panel put on our server. I setup the website (www.live8081.com) and i get a error, but when i go to MySQL Database my php connection string looks like this... PHP $dbh=mysql_connect ("localhost", "live8081_simmysq", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("live8081_directory"); so any idea when this is and how i can fix it... Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/ Share on other sites More sharing options...
snowdog Posted April 28, 2007 Share Posted April 28, 2007 YOu have to fill in your password, unless your password is <PASSWORD HERE>. I like to set mine up with variables just so it is easy to see what they are quickly. many ways you can do it. <?php $db_host = "localhost"; $db_username = "user1"; $db_password = "pass1"; $database = "database1"; $db = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error()); mysql_select_db($database) or die('Could not select database'); ?> Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240201 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 let me check but i think its like that already Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240205 Share on other sites More sharing options...
snowdog Posted April 28, 2007 Share Posted April 28, 2007 your password is set at <PASSWORD HERE> , I am pretty sure you have not put your database password in there. Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240207 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 please bear with me i am NO php expert like most of the people here Below is the code that is in that file # DATABASE CONNECTION PARAMETERS # ---------------------------------------------------------------------------------------------------- define(DEFAULT_DB, "DIRECTORYDB"); define(_DIRECTORYDB_HOST, "localhost"); define(_DIRECTORYDB_USER, "live8081_simmysq"); define(_DIRECTORYDB_PASS, "q13cz2"); define(_DIRECTORYDB_NAME, "live8081_directory"); define(_DIRECTORYDB_EMAIL, "vinicius@arcasolutions.com"); define(_DIRECTORYDB_DEBUG, "display"); allso attached is a pic of my MySQL Section of my cPanel [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240208 Share on other sites More sharing options...
Hopworks Posted April 28, 2007 Share Posted April 28, 2007 Snowdog, I used your solution, just happened to be watching my post and noticed this one, which is the next step for me. It worked just fine after I filled in the fields for the variables. Thank you! Hop Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240209 Share on other sites More sharing options...
Hopworks Posted April 28, 2007 Share Posted April 28, 2007 I don't know if anyone else noticed this, but having that access info for your database posted in a public forum is not a good idea. I'd change that asap. Am I wrong? And is 'localhost' for the database server possible? I guess if it was local, oh, sorry. I'm thinking it's on a website. Hop Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240211 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 yeah it will be changed just need to get it working 1st Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240212 Share on other sites More sharing options...
snowdog Posted April 28, 2007 Share Posted April 28, 2007 All you have to do is put your password (I marked it out in red) into your code. I would recommend that you change your usernam/password since you just posted it into a public forum. I would hope none of the fine people here would do anything !! $dbh=mysql_connect ("localhost", "live8081_simmysq", "[color=red]q13cz2[/color]") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("live8081_directory"); Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240214 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 what file would this be in because its NOT on this file config.inc.php here is the complete code for that file: \*==================================================================*/ # ---------------------------------------------------------------------------------------------------- # * FILE: /conf/config.inc.php # ---------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------- # define EDIRECTORY_ROOT to set things in motion. # ---------------------------------------------------------------------------------------------------- define(EDIRECTORY_ROOT, $_SERVER["DOCUMENT_ROOT"]); # ---------------------------------------------------------------------------------------------------- # DEFAULT URL # ---------------------------------------------------------------------------------------------------- define(DEFAULT_URL, "http://".$_SERVER["HTTP_HOST"]."/"); # ---------------------------------------------------------------------------------------------------- # DIRECTORY PATH DEFINITIONS # ---------------------------------------------------------------------------------------------------- define(ADMIN_EDIRECTORY_ROOT, EDIRECTORY_ROOT."/admin"); define(SM_EDIRECTORY_ROOT, EDIRECTORY_ROOT."/sitemgr"); # ---------------------------------------------------------------------------------------------------- # DATABASE CONNECTION PARAMETERS # ---------------------------------------------------------------------------------------------------- define(DEFAULT_DB, "DIRECTORYDB"); define(_DIRECTORYDB_HOST, "localhost"); define(_DIRECTORYDB_USER, "live8081_wwwmysi"); define(_DIRECTORYDB_PASS, "arca7"); define(_DIRECTORYDB_NAME, "wwwmysi_directory"); define(_DIRECTORYDB_EMAIL, "vinicius@arcasolutions.com"); define(_DIRECTORYDB_DEBUG, "display"); # ---------------------------------------------------------------------------------------------------- # SITE MANAGER CONSTANTS # ---------------------------------------------------------------------------------------------------- define(SM_LOGIN_PAGE, DEFAULT_URL."sitemgr/login.php"); define(SM_LOGOUT_PAGE, DEFAULT_URL."sitemgr/logout.php"); define(PERSONAL_EDIRECTORY_ROOT, EDIRECTORY_ROOT."/personal"); # ---------------------------------------------------------------------------------------------------- # ADMIN CONSTANTS # ---------------------------------------------------------------------------------------------------- define(ADMIN_LOGIN_PAGE, DEFAULT_URL."admin/login.php"); define(ADMIN_LOGOUT_PAGE, DEFAULT_URL."admin/logout.php"); # ---------------------------------------------------------------------------------------------------- # PERSONAL CONSTANTS # ---------------------------------------------------------------------------------------------------- define(PERSONAL_LOGIN_PAGE, DEFAULT_URL."personal/login.php"); define(PERSONAL_LOGOUT_PAGE, DEFAULT_URL."personal/logout.php"); # ---------------------------------------------------------------------------------------------------- # CONSTANTS # ---------------------------------------------------------------------------------------------------- define(VERSION, "v.4.1"); define(INCLUDES_DIR, EDIRECTORY_ROOT."/includes"); define(CLASSES_DIR, EDIRECTORY_ROOT."/classes"); define(FUNCTIONS_DIR, EDIRECTORY_ROOT."/functions"); define(DEFAULT_DAYS_TO_EXPIRE, 60); define(IMAGE_DIR, EDIRECTORY_ROOT."/upload/image_files"); define(IMAGE_URL, "/upload/image_files"); define(EDIRECTORY_TITLE, "MySimBook.com"); define(MAX_KEYWORDS, 10); //-------------------------------------------------------------------------------------- //sitemgr email support //-------------------------------------------------------------------------------------- $host = _DIRECTORYDB_HOST; $db = _DIRECTORYDB_NAME; $user = _DIRECTORYDB_USER; $pass = _DIRECTORYDB_PASS; $link = mysql_connect($host, $user, $pass); mysql_select_db($db); $sql_setting = "SELECT * FROM Setting"; $result_setting = mysql_query($sql_setting, $link); while($row_setting = mysql_fetch_assoc($result_setting)){ $name_setting = $row_setting["name"]; if ($name_setting == "sitemgr_support_email") { $sitemgr_support_email = $row_setting["value"]; } } define(EDIRECTORY_EMAIL, $sitemgr_support_email); //-------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------- # FLAGS - on/off # ---------------------------------------------------------------------------------------------------- define(ZIPCODE_PROXIMITY, "on"); define(EVENT_FEATURE, "off"); define(BANNER_FEATURE, "on"); define(CLASSIFIED_FEATURE, "off"); # ---------------------------------------------------------------------------------------------------- # USER ATRIBUTES # ---------------------------------------------------------------------------------------------------- define(USERNAME_MAX_LEN, 20); // don't forget to verify the field in DB define(PASSWORD_MAX_LEN, 50); // don't forget to verify the field in DB # ---------------------------------------------------------------------------------------------------- # MOD REWRITE CONSTANTS # ---------------------------------------------------------------------------------------------------- define(MR_COUNTRY_PLACEHOLDER, "International"); define(MR_STATE_PLACEHOLDER, "Local"); define(MR_CITY_PLACEHOLDER, "Online"); define(MR_CATEGORY_PLACEHOLDER, "Eletronic"); define(MR_SUBCATEGORY_PLACEHOLDER, "Directory"); # ---------------------------------------------------------------------------------------------------- # PAYPAL AND PAYMENT CONSTANTS # ---------------------------------------------------------------------------------------------------- //define(PAYPAL_URL_FOLDER, "/cgi-bin/webscr"); //define(PAYPAL_URL, "www.sandbox.paypal.com"); //define(PAYPAL_URL, "www.paypal.com"); //define(PAYPAL_ACCOUNT, "test@demodirectory.com"); //define(PAYPAL_ACCOUNT, "test@demodirectory.com"); //define(PAYPAL_CURRENCY, "USD"); //define(PAYPAL_LC, "US"); define(FREE_CATEGORIES, 1); define(FREE_CATEGORIES_LABEL, "One"); # ---------------------------------------------------------------------------------------------------- # LINKPOINT PAYMENT CONSTANTS # ---------------------------------------------------------------------------------------------------- /* arquivo encriptado para testes da arca */ //define(LINKPT_KEYFILE, "./1909740134.pem"); /* arquivo encriptado do cliente */ define(LINKPT_KEYFILE, "./1028062.pem"); /* chave de testes da arca */ //define(LINKPT_CONFIGFILE, "1909740134"); /* chave do cliente */ define(LINKPT_CONFIGFILE, "1028062"); /* link de testes */ //define(LINKPT_HOST, "staging.linkpt.net"); /* link definitivo - usar somente no live */ define(LINKPT_HOST, "secure.linkpt.net"); /* numero da porta */ define(LINKPT_PORT, "1129"); // all # ---------------------------------------------------------------------------------------------------- # REPORTS CONSTANTS # ---------------------------------------------------------------------------------------------------- define(REPORTS_SUMMARY_VIEW, 1); define(REPORTS_DETAIL_VIEW, 2); define(REPORTS_CLICK_THRU, 3); define(REPORTS_EMAIL_SENT, 4); # ---------------------------------------------------------------------------------------------------- # EMAIL NOTIFICATIONS CONSTANTS # ---------------------------------------------------------------------------------------------------- define(RENEWAL_30, 1); define(RENEWAL_7, 2); define(RENEWAL_1, 3); define(RENEWAL_15, 4); define(SYSTEM_ACCOUNT_SIGNUP, 5); define(SYSTEM_ACCOUNT_UPDATE, 6); define(SYSTEM_FORGOTTEN_PASS, 7); define(SYSTEM_NEW_ACCOUNT, ; define(SYSTEM_NEW_LISTING, 9); define(SYSTEM_NEW_EVENT, 10); # ---------------------------------------------------------------------------------------------------- # BANNER CONSTANTS # ---------------------------------------------------------------------------------------------------- define(BANNER_REPORT_CLICKTHRU, 1); define(BANNER_REPORT_VIEW, 2); # ---------------------------------------------------------------------------------------------------- # CONFIG EXTENSIONS OR MODULES (IN CASE OF PROBLEMS CHECK FOR VARIABLES CONFLIT) # ---------------------------------------------------------------------------------------------------- include_once(INCLUDES_DIR."/editor/config.php"); // html editor # ---------------------------------------------------------------------------------------------------- # IMAGE PARAMETERS (keep the ratio) # ---------------------------------------------------------------------------------------------------- # LISTING define(IMAGE_LISTING_FULL_WIDTH, 240); define(IMAGE_LISTING_FULL_HEIGHT, 200); define(IMAGE_LISTING_THUMB_WIDTH, 150); define(IMAGE_LISTING_THUMB_HEIGHT, 120); # PROMOTION define(IMAGE_PROMOTION_FULL_WIDTH, 500); define(IMAGE_PROMOTION_FULL_HEIGHT, 700); define(IMAGE_PROMOTION_THUMB_WIDTH, 200); define(IMAGE_PROMOTION_THUMB_HEIGHT, 280); # EVENT define(IMAGE_EVENT_FULL_WIDTH, 180); define(IMAGE_EVENT_FULL_HEIGHT, 150); define(IMAGE_EVENT_THUMB_WIDTH, 120); define(IMAGE_EVENT_THUMB_HEIGHT, 100); # GALLERY define(IMAGE_GALLERY_FULL_WIDTH, 500); define(IMAGE_GALLERY_FULL_HEIGHT, 380); define(IMAGE_GALLERY_THUMB_WIDTH, 132); define(IMAGE_GALLERY_THUMB_HEIGHT, 100); # CLASSIFIED define(IMAGE_CLASSIFIED_CATEGORY_WIDTH, 80); define(IMAGE_CLASSIFIED_CATEGORY_HEIGHT, 80); define(IMAGE_CLASSIFIED_LARGE_WIDTH, 500); define(IMAGE_CLASSIFIED_LARGE_HEIGHT, 500); define(IMAGE_CLASSIFIED_MEDIUM_WIDTH, 250); define(IMAGE_CLASSIFIED_MEDIUM_HEIGHT, 250); define(IMAGE_CLASSIFIED_SMALL_WIDTH, 100); define(IMAGE_CLASSIFIED_SMALL_HEIGHT, 100); # ---------------------------------------------------------------------------------------------------- # INCLUDE GLOBAL CLASSES # ---------------------------------------------------------------------------------------------------- include_once(CLASSES_DIR."/class_mysql.php"); include_once(CLASSES_DIR."/class_handle.php"); include_once(CLASSES_DIR."/class_status.php"); include_once(CLASSES_DIR."/class_level.php"); include_once(CLASSES_DIR."/class_approved.php"); include_once(CLASSES_DIR."/class_account.php"); include_once(CLASSES_DIR."/class_contact.php"); include_once(CLASSES_DIR."/class_editorChoice.php"); include_once(CLASSES_DIR."/class_emailNotification.php"); include_once(CLASSES_DIR."/class_listing.php"); include_once(CLASSES_DIR."/class_image.php"); include_once(CLASSES_DIR."/class_gallery.php"); include_once(CLASSES_DIR."/class_promotion.php"); include_once(CLASSES_DIR."/class_category.php"); include_once(CLASSES_DIR."/class_reports.php"); include_once(CLASSES_DIR."/class_listingChoice.php"); include_once(CLASSES_DIR."/class_locationCountry.php"); include_once(CLASSES_DIR."/class_locationState.php"); include_once(CLASSES_DIR."/class_locationRegion.php"); include_once(CLASSES_DIR."/class_locationCity.php"); include_once(CLASSES_DIR."/class_locationArea.php"); include_once(CLASSES_DIR."/class_urlQueryGenerator.php"); include_once(CLASSES_DIR."/class_thumbGenerator.php"); include_once(CLASSES_DIR."/class_xlsGenerator.php"); include_once(CLASSES_DIR."/class_formValidator.php"); include_once(CLASSES_DIR."/class_paymentLog.php"); include_once(CLASSES_DIR."/class_paymentListingLog.php"); include_once(CLASSES_DIR."/class_forgotPassword.php"); include_once(CLASSES_DIR."/class_pageBrowsing.php"); include_once(CLASSES_DIR."/class_content.php"); include_once(CLASSES_DIR."/class_tip.php"); include_once(CLASSES_DIR."/class_invoice.php"); include_once(CLASSES_DIR."/class_invoiceListing.php"); include_once(CLASSES_DIR."/class_invoiceStatus.php"); include_once(CLASSES_DIR."/class_banner.php"); include_once(CLASSES_DIR."/class_bannerReports.php"); include_once(CLASSES_DIR."/class_uploadFiles.php"); include_once(CLASSES_DIR."/class_rating.php"); include_once(CLASSES_DIR."/class_discountCodeStatus.php"); include_once(CLASSES_DIR."/class_discountCode.php"); include_once(CLASSES_DIR."/class_event.php"); include_once(CLASSES_DIR."/class_evCategory.php"); include_once(INCLUDES_DIR."/editor/editor_class.php"); // html editor include_once(CLASSES_DIR."/class_classifiedCategory.php"); include_once(CLASSES_DIR."/class_classifiedLevel.php"); include_once(CLASSES_DIR."/class_classifiedListing.php"); include_once(CLASSES_DIR."/class_classifiedStatus.php"); include_once(CLASSES_DIR."/class_carriers.php"); include_once(CLASSES_DIR."/class_listingCategory.php"); include_once(CLASSES_DIR."/class_phonecontact.php"); include_once(CLASSES_DIR."/class_messages.php"); include_once(CLASSES_DIR."/class_simbooks.php"); include_once(CLASSES_DIR."/class_LogMessages.php"); include_once(CLASSES_DIR."/class_messagesadmin.php"); include_once(CLASSES_DIR."/class_preferred.php"); include_once(CLASSES_DIR."/class_LogMessagesAdmin.php"); include_once(CLASSES_DIR."/class_PersonalAccount.php"); include_once(CLASSES_DIR."/class_MessagesFriends.php"); include_once(CLASSES_DIR."/class_Friends.php"); include_once(CLASSES_DIR."/class_LogMessagesFriends.php"); include_once(CLASSES_DIR."/class_FriendsGroup.php"); # ---------------------------------------------------------------------------------------------------- # INCLUDE GLOBAL FUNCTIONS # ---------------------------------------------------------------------------------------------------- include_once(FUNCTIONS_DIR.'/db_funct.php'); include_once(FUNCTIONS_DIR.'/html_funct.php'); include_once(FUNCTIONS_DIR.'/validate_funct.php'); include_once(FUNCTIONS_DIR.'/search_funct.php'); include_once(FUNCTIONS_DIR.'/format_funct.php'); include_once(FUNCTIONS_DIR.'/image_funct.php'); include_once(FUNCTIONS_DIR.'/system_funct.php'); include_once(FUNCTIONS_DIR.'/sess_funct.php'); include_once(FUNCTIONS_DIR.'/setting_funct.php'); include_once(FUNCTIONS_DIR.'/report_funct.php'); include_once(INCLUDES_DIR."/editor/editor_functions.php"); // html editor if (ZIPCODE_PROXIMITY == "on") include_once(FUNCTIONS_DIR.'/zipproximity_funct.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240225 Share on other sites More sharing options...
snowdog Posted April 28, 2007 Share Posted April 28, 2007 In your actual code, not in your config/setup Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240232 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 ok, i have downloaded the site on my PC and using Dreamweaver to edit, how would i go about finding where this code is? also i have taken all the code out of the index.php file and in the www directory, the only thin in that file on the server is coming soon... and still when i navagate to the www.live8081.com.index.php i get the same error... Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240244 Share on other sites More sharing options...
mmarif4u Posted April 28, 2007 Share Posted April 28, 2007 1st of all please change ur password for ur mysql. And please dont post ur real password or user name in forums. Now to ur problem. Ur code is ok just change ur password in the script u mention before or ur 1st post at the top. Or simply try this one: $dbh=mysql_connect ("localhost", "live8081_simmysq", "q13cz2") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("live8081_directory"); Hope this help u. Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240245 Share on other sites More sharing options...
snowdog Posted April 28, 2007 Share Posted April 28, 2007 Just what I said earlier Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240247 Share on other sites More sharing options...
mmarif4u Posted April 28, 2007 Share Posted April 28, 2007 Please post ur index.php code Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240248 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 ok where the hell is this code at. i know i posted the code in my VERY 1st post but i copied that strignt from the MySQL Databases Page in cPanel I guess i am making thos more complicated than it is... Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240249 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 Editing /home/live8081/public_html/index.php... Coming Soon... Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240253 Share on other sites More sharing options...
mmarif4u Posted April 28, 2007 Share Posted April 28, 2007 I guess i am making thos more complicated than it is... Yeh u take more complicated, just post ur code here. Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240254 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 the only code my index.php page has in it is Coming Soon... so i dunno where this error is coming from at all... That is why i am confused... Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240257 Share on other sites More sharing options...
mmarif4u Posted April 28, 2007 Share Posted April 28, 2007 It means that ur index.php page is empty. Ok put this code in index.php and upload it ur server: <?php echo phpinfo(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240261 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 could this be a server issue? Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240263 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 also here is a pic, i put the code you gave me in the index.php file and the error still shows up... [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240264 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 whats the exact error, or maybe a link to the site! Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240265 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 www.live8081.com Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240267 Share on other sites More sharing options...
dguilloryjr Posted April 28, 2007 Author Share Posted April 28, 2007 i am starting to think this is a server issue Quote Link to comment https://forums.phpfreaks.com/topic/49029-php-connection-string/#findComment-240269 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.