Re: Waiting for localhost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




------------ Original Message ------------
> Date: Thursday, April 02, 2015 00:18:45 -0400
> From: Ethan Rosenberg <erosenberg@xxxxxxxxxxxxxxxxxxxx>
> To: php-db@xxxxxxxxxxxxx
> Cc: 
> Subject: Re:  Waiting for localhost
>
> On 04/01/2015 11:41 PM, Karl DeSaulniers wrote:
>> Question to list, since I have not had to venture to the mysqli
>> territory just yet, but is it proper to use mysql_error() with
>> mysqli transactions?
>> 
>> This may be what your missing Ethan.
>> mysql_error() looks for a mysql_ transactions doesn't it?
>> Or are they interchangeable?
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>> 
>> 
>> 
>> On Apr 1, 2015, at 10:35 PM, Ethan Rosenberg
>> <erosenberg@xxxxxxxxxxxxxxxxxxxx> wrote:
>>>>> 
>>> <snip>
>>> 
>>> Richard -
>>> 
>>> Thanks.
>>> 
>>> The problem is in the database connection.
>>> 
>>> from MySQL
>>> 
>>> mysql> show tables;
>>> +-----------------+
>>> | Tables_in_Store |
>>> +-----------------+
>>> | Charges         |
>>> | Customers       |
>>> | Food            |
>>> | Inventory       |
>>> | Orders          |
>>> | Purchases       |
>>> +-----------------+
>>> 
>>> This code works...
>>> 
>>> $hostname="localhost";
>>> $database="Store";
>>> $username="ethan";
>>> $password="xxxxx";
>>> 
>>> 
>>> $link = mysqli_connect($hostname, $username, $password);
>>> if (!$link) {
>>> die('Connection failed: ' . mysql_error());
>>> }
>>> else{
>>>      echo "Connection to MySQL server " .$hostname . "
>>>      successful! " . PHP_EOL;
>>> }
>>> 
>>> $db_selected = mysqli_select_db($link, $database);
>>> if (!$db_selected) {
>>>     die ('Can\'t select database: ' . mysql_error());
>>> }
>>> else {
>>>     echo 'Database ' . $database . ' successfully selected!';
>>> }
>>> 
>>> $sql1 = "show tables";
>>> $result1 = mysqli_query($link, $sql1);
>>> $row1 = mysqli_fetch_array($result1);
>>> 	echo 'row1<br />';
>>> 	print_r($row1);
>>> 
>>> BUT
>>> 
>>> The output is ....
>>> 
>>> Connection to MySQL server localhost successful! Database Store
>>> successfully selected! row1
>>> Array ( [0] => Charges [Tables_in_Store] => Charges )
>>> 
>>> What am I missing??
>>> 
>>> TIA
>>> 
>>> Ethan
> -----
> 
> Dear List -
> 
> Here are some hints....
> 
> service apache2 restart
> [....] Restarting web server: apache2AH00558: apache2: Could not
> reliably determine the server's fully qualified domain name, using
> 127.0.1.1. Set the 'ServerName' directive globally to suppress
> this message
> . ok
> 
> 
>   using 127.0.1.1 OUCH
> 
> Added this as last line in  /etc/apache2/apache2.conf
> 
> ServerName localhost
> 
> root@meow:/var/www# service apache2 restart
> [ ok ] Restarting web server: apache2
> 
> OK ...good
> 
> But ... I am still getting the same performance - TestConnect [the
> code above] gives the same result, and HandleWeight hangs!!!
> 

As I pointed out on the apache list, 127.0.1.1 != localhost. It's
not clear where all you've stapled that incorrect value in at this
point, but that will account for why apache gave you that error.

In the php code, you are not handling the output from
mysqli_fetch_array correctly. Read the documentation, there are many
examples -- including q/a responses that almost exactly match your
code.

You have shown no debugging effort on "HandleWeight", so we have no
way of providing any insights on it.

You additionally need to provide the version/release level
information for your installed versions of:

  - OS
  - apache
  - mysql
  - php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux