This question already has an answer here:
What to do with mysqli problems? Errors like mysqli_fetch_array(): Argument #1 must be of type mysqli_result and such
(1 answer)
Closed 2 years ago.
Here's My setup I have gone over it twice already and have come up with nothing.
I am currently working on a LAMP stack and most of the configurations have been done properly.
I have two files
1. connect.php
2. registration.php
code of connect.php is as follows:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$hostname="localhost"; //local server name
$username="user_name"; //mysql username
$password="my_password"; //mysql password
$database="my_database"; //database name
// Create Connection to DB using an Object
$con= mysqli_connect($hostname,$username,$password); //do i need to pass database name also as an argument to this?
//Check Connection
if(mysqli_connect_errno()){
echo"Failed to connect! due to : " . mysqli_connect_errno();
} else{
echo"Connected!";
}
?>
code of registration.php is as follows:
<?php //start php tag
include("/var/www/calculator/connect.php"); //using absolute path to avoid any confusion
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Connected! on Registration Page"); //executes till here with no problems
}
if (mysqli_query($conn, "CREATE table users"))
{
printf("Query Executed!", mysqli_affected_rows($conn))
}
mysqli_close($link);
?>
Some have suggested to take a look at the apache server logs here is the last 10 output of the logs
::1 - - [24/Feb/2020:13:14:41 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:43 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:44 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:15:37 +0530] "-" 408 0 "-" "-"
::1 - - [24/Feb/2020:13:15:37 +0530] "-" 408 0 "-" "-"
I need help on why my queries are not getting executed despite my code having no coding errors or query structure errors.
You've missed ;:
if (mysqli_query($conn, "CREATE table users"))
{
printf("Query Executed!", mysqli_affected_rows($conn)) // <---- here
}
Also, read about mysqli_connect. You should use 4 arguments, but can pass '' value in one of it.
Related
So there is the problem:
I've made some php code to register page views (with a lot of help from stack overflow). I specifically want to avoid using cookies for this. Also I would prefer not to use an SQL DB if it is possible a well working solution without it.
To deal with browser behaviour like prefetching and the like, I am trying to filter out the extra page views with an if, elseif, else function.
The problem in practice is that the sometimes pageviews are either written twice to the log file or there is a timing issue with the if-statement and the rest of the code.
Here is the code I have:
<?php
/*set variables for log file */
$useragnt = $_SERVER['HTTP_USER_AGENT']; //get user agent
$ipaddrs = $_SERVER['REMOTE_ADDR']; //get ipaddress
$filenameLog = "besog/" . date("Y-m-d") . "LOG.txt";
date_default_timezone_set('Europe/Copenhagen');
$infoToLog = $ipaddrs . "\t" . $useragnt . "\t" . date('H:i:s') . "\n";
$file_arr = file($filenameLog);
$last_row = $file_arr[count($file_arr) - 1];
$arr = explode( "\t", $last_row);
$tidForSidsteLogLinje = strtotime($arr[2]);
$tidNu = strtotime(date('H:i:s'));
//write ip, useragent and time of page view to log file logfil, but only if the same visitor has not viewed the page within the last 10 seconds
if ($arr[0] == $ipaddrs and $arr[1] == $useragnt and $tidNu - $tidForSidsteLogLinje > 10){
//write ip and user agent to textfile
$file = fopen($filenameLog, "a+");
fwrite($file, $infoToLog);
fclose($file);
}
elseif ($arr[0] == $ipaddrs and $arr[1] == $useragnt and $tidNu - $tidForSidsteLogLinje < 10){
die;
}
else {
//Write ip and user agent to textfile
$file = fopen($filenameLog, "a+");
fwrite($file, $infoToLog);
fclose($file);
}
?>
Here are examples of the duplicate entries in the log (I have masked some of the ipaddresses):
xxx.x.95.240 Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko 12:52:33
xx.xxx.229.91 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 12:52:45
xx.xxx.229.91 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 12:52:45
xxx.xx.154.83 ServiceTester/4.4.64.1514 12:53:03
xxx.xx.91.126 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5 12:53:05
xx.xxx.35.3 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 12:53:09
xxx.xxx.130.34 Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko 12:53:56
xxx.xxx.130.34 Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko 12:53:56
xx.xxx.211.101 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 12:54:11
x.xxx.54.4 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17 12:54:33
If my if-statements were working as intended, it should be possible to see duplicate lines in the entries like in the above.
How do I improve the code to eliminate these duplicate entries?
And help or suggestions is much appreciated!
We use a Complex Website Visitor Track / log System in our system.
I would recomend that you store this Values in a Database and set the IP address field as Unique.
You can set an CookieID like
Cookie::set('__id', time());
and go like
if (isset($_COOKIE['__id'])){
//With mysql you go like
$db->Execute("INSERT IGNORE INTO VisitorTable(hash, ip,..)
VALUES($_COOKIE['__id'],$_SERVER['REMOTE_ADDR'] )" // the HTTP_USER_AGENT refferer all kind of information that you wannt to store
}
This way the Visitor Only exist once in your list. See insert ignore for more.
Now you can eazy make an other function to save the pages the user visits .
In a script that gets everytime executet you go like:
$db->Execute("INSERT INTO VisitorActivity (visitorID,page....) VALUES ($_COOKIE['__id'],$_Server['..'])" );
Below is the form I'm using to submit a new wheel into a DB on my local XAMPP server, problem is the post method doesn't work, I had problems with a modal which was sorted by using $_GET instead. I've changed a few php.ini settings but have changed them back was, max_upload and another one, I've read about them in other questions but they don't seem to solve the issue.
When I use the submit form below the array printed is just Array(), doesn't even have a single value, this should prompt my error check to print an error at the least.
<!-- wheels form -->
<div class="text-center">
<form class="form-inline" action="wheels.php" method="post">
<div class="form-group">
<label for="wheelName">Add a new wheel:</label>
<input name="wheelName" type="text" id="wheelName" class="form-control" value="<?=((isset($_POST['wheelName']))?$_POST['wheelName']:''); ?> "><!-- shorthand if/else-->
<label for="code">Stockcode</label>
<input name="code" type="text" id="code" class="form-control" value="<?=((isset($_POST['code']))?$_POST['code']:''); ?> "><!-- shorthand if/else-->
<input type="submit" name="add_submit" value="add wheel" class="btn btn-success">
</div>
</form>
</div><hr>
Standard php sql input and checks, the information is being pulled correctly as I have it displaying in a table further on my page.But the $_POST variable appears to be completely empty, has someone had this problem and managed to sort it? I'm assuming its to do with my php setup or .htaccess as someone else had an issue with.
<?php
require_once '../core/init.php';
include 'includes/header.php';
include 'includes/navigation.php';
// Get wheels from DB
$sql = "SELECT * FROM wheels ORDER BY part_no";
$result = $db->query($sql);
$errors = array();
// edit wheel
if(isset($_GET['edit']) && !empty(['edit'])) {
$edit_id = (int)$_GET['edit'];
$edit_id = sanitize('edit_id');
//$sql2 = "SELECT * FROM wheels WHERE recid = '$edit_id'";
//$edit_result = $db->query($sql2);
//$eWheel = mysqli_fetch_assoc($edit_result);
}
// Delete wheel
if(isset($_GET['delete']) && !empty(['delete'])) {
$delete_id = (int)$_GET['delete'];
$delete_id = sanitize($delete_id);
//$sql = "DELETE FROM wheels WHERE recid = '$delete_id'";
//$db->query($sql);
//header('Location: wheels.php');
}
// If add wheel form submitted
if(isset($_POST['add_submit'])) {
$wheel = sanitize($_POST['wheelName']);
$stockCode = sanitize($_POST['stockCode']);
// check if wheel is blank
if($_POST['wheelName'] == '') {
$errors[] .= 'Must enter wheel';
}
// if wheel exists in db
$sql = "SELECT * FROM wheels WHERE stockcode = '$stockCode'";
$result = $db->query($sql);
$count = mysqli_num_rows($result);
if($count > 0) {
$errors[] .= 'that wheel already exists.';
}
// display errors
if(!empty($errors)) {
echo displayErrors($errors);
} else {
//Add wheels to DB // incomplete unsure if feature needed at this stage.
// $sql = "INSERT INTO wheels (wheelName, stockCode, ID ETC ETC VALUES Etc ETC
// $db->query($sql);
// header ('location : wheels.php ');
}
}
var_dump($_POST);
echo file_get_contents("php://input");
?>
Here is the log
::1 - - [23/Apr/2016:14:12:32 +1200] "GET / HTTP/1.1" 302 - "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:32 +1200] "GET /dashboard/ HTTP/1.1" 200 6904 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:32 +1200] "GET /dashboard/stylesheets/normalize.css HTTP/1.1" 200 6876 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:32 +1200] "GET /dashboard/stylesheets/all.css HTTP/1.1" 200 481308 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:32 +1200] "GET /dashboard/javascripts/modernizr.js HTTP/1.1" 200 51365 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:33 +1200] "GET /dashboard/javascripts/all.js HTTP/1.1" 200 189003 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:33 +1200] "GET /dashboard/images/xampp-logo.svg HTTP/1.1" 200 5427 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:33 +1200] "GET /dashboard/images/bitnami-xampp.png HTTP/1.1" 200 22133 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:33 +1200] "GET /dashboard/images/fastly-logo.png HTTP/1.1" 200 1770 "http://localhost/dashboard/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
::1 - - [23/Apr/2016:14:12:33 +1200] "GET /dashboard/images/social-icons.png HTTP/1.1" 200 3361 "http://localhost/dashboard/stylesheets/all.css" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
well, i think you should place the <?php line at the very top of the file... before the "Get wheels from DB" comment
And instead of print_r($_POST); use var_dump($_POST);
also, in the section "if wheel exists in db" your sql query is never using the $stockCode variable, you're missing the $ , it should be $sql = "SELECT * FROM wheels WHERE stockcode = '$stockCode'";
And drop the point before the equal sign for the errors. thats for Strings, and as an array $errors[] = 'that wheel already exists.'; should work fine
I am new to php. Iam trying to parse log file and expecting array output. But unfortunately the output is empty with no errors/warnings.
I am trying to follow this example, here: http://www.phpclasses.org/package/2596-PHP-Parse-Apache-log-files-in-the-common-log-format.html
Below is the code:
apache-log-parser.php
<?php
class apache_log_parser
{
var $bad_rows; // Number of bad rows
var $fp; // File pointer
function format_log_line($line)
{
preg_match("/^(\S+) (\S+) (\S+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\S+) (.*?) (\S+)\" (\S+) (\S+) (\".*?\") (\".*?\")$/", $line, $matches); // pattern to format the line
return $matches;
}
function format_line($line)
{
$logs = $this->format_log_line($line); // format the line
if (isset($logs[0])) // check that it formated OK
{
$formated_log = array(); // make an array to store the lin info in
$formated_log['ip'] = $logs[1];
$formated_log['identity'] = $logs[2];
$formated_log['user'] = $logs[2];
$formated_log['date'] = $logs[4];
$formated_log['time'] = $logs[5];
$formated_log['timezone'] = $logs[6];
$formated_log['method'] = $logs[7];
$formated_log['path'] = $logs[8];
$formated_log['protocal'] = $logs[9];
$formated_log['status'] = $logs[10];
$formated_log['bytes'] = $logs[11];
$formated_log['referer'] = $logs[12];
$formated_log['agent'] = $logs[13];
return $formated_log; // return the array of info
}
else
{
$this->bad_rows++; // if the row is not in the right format add it to the bad rows
return false;
}
}
function open_log_file($file_name)
{
$this->fp = fopen($file_name, 'r'); // open the file
if (!$this->fp)
{
return false; // return false on fail
}
return true; // return true on sucsess
}
function close_log_file()
{
return fclose($this->fp); // close the file
}
// gets a line from the log file
function get_line()
{
if (feof($this->fp))
{
return false;
}
$bits='';
// I find for loops much much faster
for (;!feof($this->fp) && $bits != "\n";)
{
$bits .= fread($this->fp, 1);
}
return rtrim($bits, "\n");
}
}
?>
example.php
<?php
include 'apache-log-parser.php';
$apache_log_parser = new apache_log_parser(); // Create an apache log parser
if ($apache_log_parser->open_log_file('example.log')) // Make sure it opens the log file
{
while ($line = $apache_log_parser->get_line()) { // while it can get a line
//print_r($line);
$parsed_line = $apache_log_parser->format_line($line); // format the line
//var_export($parsed_line);
// print_r($parsed_line); // print out the array
}
$apache_log_parser->close_log_file(); // close the log file
}
else
{
echo 'Sorry cannot open log file.';
}
?>
example.log
172.0.0.1 - - [21/Sep/2005:23:06:37 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:38 +0100] "GET / HTTP/1.1" 200 1647 "http://www.example.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:38 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:38 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:39 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:40 +0100] "GET / HTTP/1.1" 200 12372 "http://www.example.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:40 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:41 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
172.0.0.1 - - [21/Sep/2005:23:06:41 +0100] "GET / HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+"
I will be glad if someone look into this and suggest me what changes to make.
I have a text file, a huge one that contains some information's that I need to insert into a database.
Here is the one of the rows of the text file:
77.242.22.86 - - [10/Jul/2013:14:07:26 +0200] "GET /web/img/theimage.jpg HTTP/1.1" 304 - "http://www.mywebiste.com/web/"
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36 AlexaToolbar/alxg-3.1"
I am using some php functions like:
$myFile = "testFile.txt";
$fh = fopen($myFile, 'r');
This only read the text file, as I said, I need to get the data and insert into the database, here is an example how I need the row to be spli:
77.242.22.86
[10/Jul/2013:14:07:26 +0200]
GET
/web/img/theimage.jpg
HTTP/1.1
304
http://www.mywebiste.com/web/
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36 AlexaToolbar/alxg-3.1
Please help me to resolve this problem. Thank you.
$test ='77.242.22.86 - - [10/Jul/2013:14:07:26 +0200]
"GET /web/img/theimage.jpg HTTP/1.1" 304 - "http://www.mywebiste.com/web/"
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36 AlexaToolbar/alxg-3.1"';
function tokenizer($test) {
$test = trim(strtolower($test));
$res= str_replace(",","",$test);
$res= str_replace("-","",$res);
$res= str_replace(' "',"",$res);
$result= explode(" ", $res);
for ($i = 0; $i < count($result); $i++) {
$result[$i] = trim($result[$i]);
echo $result[$i]; ?>
<hr/> <?php
}
return $result; // contains the single words
}
I put the password and root user (root and press enter).. then the phpmyadmin runs indefinitely..and never reaches inside. Also I would like to remove the authentication screen altogther..how do I do that..
Here is my config.inc.php file:
<?php
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type and info
$cfg['Servers'][$i]['auth_type'] = 'cookie';
*/
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
$cfg['Servers'][$i]['port'] = '8080';
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
/*
* End of servers configuration
*/
?>
UPDATE:
This is how I approach phpmyadmin:
http://localhost:8080/phpmyadmin/
swapping this:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
to this:
$cfg['Servers'][$i]['auth_type'] = 'config';
Didnt work, I still get a long loading time..and nothing appears in the end
php_error_log:
[22-Nov-2012 08:35:56 UTC] PHP Warning: file_get_contents(lang.tmp): failed to open stream: No such file or directory in C:\xampp\htdocs\xampp\index.php on line 2
[22-Nov-2012 08:46:59 UTC] PHP Warning: file_get_contents(lang.tmp): failed to open stream: No such file or directory in C:\xampp\htdocs\xampp\index.php on line 2
[22-Nov-2012 09:01:38 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\phpmyadmin\libraries\session.inc.php on line 96
error file from C:\xampp\apache\logs
[Thu Nov 22 10:56:28.128254 2012] [mpm_winnt:notice] [pid 992:tid 252] AH00418: Parent: Created child process 4152
[Thu Nov 22 10:56:29.065254 2012] [ssl:warn] [pid 4152:tid 264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Nov 22 10:56:29.098254 2012] [mpm_winnt:notice] [pid 4152:tid 264] AH00354: Child: Starting 150 worker threads.
[Thu Nov 22 11:15:44.631864 2012] [core:warn] [pid 6036:tid 252] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Nov 22 11:15:44.928894 2012] [ssl:warn] [pid 6036:tid 252] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Nov 22 11:15:44.961897 2012] [mpm_winnt:notice] [pid 6036:tid 252] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[Thu Nov 22 11:15:44.961897 2012] [mpm_winnt:notice] [pid 6036:tid 252] AH00456: Server built: Aug 18 2012 12:41:37
[Thu Nov 22 11:15:44.961897 2012] [core:notice] [pid 6036:tid 252] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Nov 22 11:15:44.962897 2012] [mpm_winnt:notice] [pid 6036:tid 252] AH00418: Parent: Created child process 6056
[Thu Nov 22 11:15:45.790980 2012] [ssl:warn] [pid 6056:tid 264] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Nov 22 11:15:45.823984 2012] [mpm_winnt:notice] [pid 6056:tid 264] AH00354: Child: Starting 150 worker threads.
Some of the details from access file in the same folder:
::1 - - [22/Nov/2012:10:56:32 +0200] "GET /phpmyadmin/phpmyadmin.css.php?server=1&token=437f6c565c1596df2943490f3a782513&js_frame=right&nocache=4043133233 HTTP/1.1" 200 82604 "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:10:56:32 +0200] "GET /phpmyadmin/js/messages.php?lang=en&db=&token=437f6c565c1596df2943490f3a782513 HTTP/1.1" 200 16556 "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:10:56:33 +0200] "GET /phpmyadmin/themes/pmahomme/img/logo_right.png HTTP/1.1" 200 4548 "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:10:56:33 +0200] "GET /phpmyadmin/themes/pmahomme/img/input_bg.gif HTTP/1.1" 200 170 "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:10:56:38 +0200] "POST /phpmyadmin/index.php HTTP/1.1" 302 - "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:11:01:38 +0200] "-" 408 - "-" "-"
::1 - - [22/Nov/2012:10:56:38 +0200] "GET /phpmyadmin/index.php?token=437f6c565c1596df2943490f3a782513 HTTP/1.1" 200 - "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:10:57:54 +0200] "POST /phpmyadmin/index.php HTTP/1.1" 200 154 "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:11:09:09 +0200] "POST /phpmyadmin/index.php HTTP/1.1" 302 - "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:11:14:09 +0200] "-" 408 - "-" "-"
::1 - - [22/Nov/2012:11:09:09 +0200] "GET /phpmyadmin/index.php?token=437f6c565c1596df2943490f3a782513 HTTP/1.1" 200 - "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:11:20:51 +0200] "-" 408 - "-" "-"
::1 - - [22/Nov/2012:11:15:50 +0200] "POST /phpmyadmin/index.php HTTP/1.1" 200 - "http://localhost:8080/phpmyadmin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:11:33:05 +0200] "GET /Dummy/index.php HTTP/1.1" 200 193 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
::1 - - [22/Nov/2012:11:33:38 +0200] "GET /Dummy/index.php HTTP/1.1" 200 193 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"
Now I get:
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\phpmyadmin\libraries\session.inc.php on line 96
Is there a way to disable session completely?
Last Changes:
$cfg['Servers'][$i]['port'] = '8080';
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '12345';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
Now I cant even reach the panel :(
Try uncommenting the line below line:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
and change auth_type to config
$cfg['Servers'][$i]['auth_type'] = 'config';
EDIT:
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'your_mysql_user_here';
$cfg['Servers'][$i]['password'] = 'your_mysql_password_here';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
HERE you can see find instruction as on how to reset MySQL password in case you had typo etc.
You can try changing
$cfg['Servers'][$i]['host'] = '127.0.0.1';
to
$cfg['Servers'][$i]['host'] = 'localhost';
and
/* Authentication type and info
$cfg['Servers'][$i]['auth_type'] = 'cookie';
*/
to
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
Additionally, you need the below line also:
$cfg['Servers'][$i]['extension'] = 'mysqli';