Re: Waiting for localhost

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

 




------------ Original Message ------------
> Date: Thursday, April 02, 2015 13:48:06 -0400
> From: Ethan Rosenberg <erosenberg@xxxxxxxxxxxxxxxxxxxx>
> To: php-db@xxxxxxxxxxxxx
> Subject: Re:  Waiting for localhost
>
> On 04/02/2015 06:17 AM, Richard wrote:
>> 
>> 
> 
> <snip>
>>> 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
> 
> Richard -
> 
> Thanks.
> 
> 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
> 
> This is what was returned on a restart of Apache.
> 
> Modified the configuration file.....
> 
>   Added this as last line in  /etc/apache2/apache2.conf
>  >>
>  >> ServerName localhost
> 
> Now on a restart...
> 
>   root@meow:/var/www# service apache2 restart
>  >> [ ok ] Restarting web server: apache2
> 
> Fixed the mysqli_fetch_array.
> 
> OS Debian Jessie
> Apache/2.4.9 (Debian)
> MySQL  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64)
> using readline 6.3
> PHP  5.6.0RC2 (cli)
> 
> Debug
> 
> Here is the connection block w/ debug.
> 
> $hostname="localhost";
> $database="Store";
> $username="ethan";
> $password="xxxxx";
> 
> 
> $link = mysqli_connect($hostname, $username, $password);
> if (!$link) {
> die('Connection failed: ' . mysqli_error());
> }
> else{
>       echo "Connection to MySQL server " .$hostname . " successful!
> " . PHP_EOL;
> }
> 
> $db_selected = mysql_select_db( $link,$database);
> if (!$db_selected) {
>      die ('Can\'t select database: ' . mysql_error());
> }
> else {
>      echo 'Database ' . $database . ' successfully selected!';
> }
> 
> Never connects. Hangs
> 

What "Never connects. Hangs" -- your test php page, or HandleWeight?
In either case, that and the "Debug" code that you included above is
basically useless for determining your problem(s). You need to work
through your code from the top, bit by bit, until you know that each
piece to that point works. Put in "if $debug" statements (or
whatever approach you want) so that you can see exactly what's being
returned at each point. This is "programming 101" level debugging,
and something that many of us have suggested over many months of
trying to help you.

[As an aside, you may have fixed this, but you have had 127.0.1.1
listed as "localhost" somewhere (/etc/hosts, apache config, php
code). That won't work. Set the IPnumber for "localhost" to the
correct value.]

I don't have any more time for this. Good luck.




-- 
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