httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bradley Giesbrecht <b...@pixilla.com>
Subject Re: [users@httpd] Not Sure If This Is An Appache Problem Or a PHP problem
Date Fri, 26 Sep 2008 23:53:31 GMT

On Sep 26, 2008, at 4:33 PM, Xpert Advice wrote:

> Bradley you are the best!!  So I went to the page that u sent below  
> that has information specific to vista and now when i run the php  
> test page i actuall get a path!!!
>
> Configuration File (php.ini) Path
> C:\Windows
> Loaded Configuration File
> C:\php\php.ini
> Yeah!!! but wait there's one last problem :-) .
>
> Remember Im using Windows Vista, Apache2.2, Php5 and the latest  
> version of mysql.  So im  trying to load my test page for mysql in  
> the browser and I get a "this website cannot be displayed" error  
> HTTP 500.  This is the test page that im running: ( not sure if  
> there's something wrong with the codes or if i have a new problem  
> now)  Thanks in advance guys.
>
> <?php
> /* Program: mysql_up.php
>  * Desc:    Connects to MySQL Server and
>  *          outputs settings.
>  */
>  echo "<html>
>        <head><title>Test MySQL</title></head>
>        <body>";
>  $host="localhost";
>  $user="root";
>  $password="Antigua";
>  $cxn = mysqli_connect($host,$user,$password);
>  $sql="SHOW STATUS";
>  $result = mysqli_query($cxn,$sql);
>  if($result == false)
>  {
>     echo "<h4>Error: ".mysqli_error($cxn)."</h4>";
>  }
>  else
>  {
>     /* Table that displays the results */
>     echo "<table border='1'>
>           <tr><th>Variable_name</th>
>               <th>Value</th></tr>";
>     for($i = 0; $i < mysqli_num_rows($result); $i++)
>     {
>        echo "<tr>";
>        $row_array = mysqli_fetch_row($result);
>         for($j = 0;$j < mysqli_num_fields($result);$j++)
>         {
>            echo "<td>".$row_array[$j]."</td>\n";
>         }
>      }
>      echo "</table>";
>  }
> ?>
> </body></html>
>
>
> Tianja Samuel-George
> President
>
>
> ----- Original Message ----
> From: Bradley Giesbrecht <brad@pixilla.com>
> To: users@httpd.apache.org
> Sent: Friday, September 26, 2008 11:01:43 AM
> Subject: Re: [users@httpd] Not Sure If This Is An Appache Problem Or  
> a PHP problem
>
>
> On Sep 25, 2008, at 9:57 PM, Xpert Advice wrote:
>
>> grrrrrrrr  Ok that didnt work either.  Moved it again to the  
>> windows directory and restarted everything and still nothing.  This  
>> must be a bad trick that my computer is playing on me.  Does it  
>> have anything to do with windows vista?  And yes I finally turned  
>> off the user account control.  Im pasting the original message  
>> below in case we missed something.
>>
>>
>> Hello,
>> I am trying to test that php is working properly with apache and  
>> with mysql and I keep getting the following error:
>>
>> Fatal error: Call to undefined function mysqli_connect() in C: 
>> \Apache2.2\htdocs\mysql_up.php on line 13
>>
>> Now I have done absolutely everything that I have read in all of  
>> these forums and it still is not working.  Below is a list of all  
>> that I have done so far:
>>    1.  Addded PHP to the windows path by going to "Advanced System  
>> Settings" and adding C:/php to the path.
>>    2.  The php.ini file is currently located at c:/php/php.ini
>>    3.  I have tried moving the php.ini file to the windows folder  
>> of my computer that didnt work.
>>    4.  I have removed the restrictive comment from the extension  
>> php_mysqli.dll
>>   5.  I have re started apache several times.
>>   6.  Php in itself does seem to be working because I did create a  
>> test php page and below is what shows up on that page.  From what I  
>> have read the fact that the loadedconfiguration file section is  
>> blank means that my computer is not able to locate the php.ini file  
>> but i honestly have no clue where else to put it because i've tried  
>> copying it everywhere to no avail.
>>
>> Please help if you can.  Below is what I got from a test page when  
>> i tested php alone on apache...however when i try to test if all  
>> three are working i get the above error.
>>
>>
>>
>> Tianja Samuel-George
>> President
>>
>>
>> ----- Original Message ----
>> From: "William A. Rowe, Jr." <wrowe@rowe-clan.net>
>> To: users@httpd.apache.org
>> Sent: Friday, September 26, 2008 12:40:15 AM
>> Subject: Re: [users@httpd] Not Sure If This Is An Appache Problem  
>> Or a PHP problem
>>
>> Xpert Advice wrote:
>> > Ok time to start banging my head against the wall.  So I turned  
>> off the
>> > user account controls and tried everything again...still didnt  
>> work.
>> > when i run the test page im still getting this:
>> >
>> > Configuration File (php.ini) Path     C:\Windows
>> >
>> > Loaded Configuration File     (none)
>>
>> It went poof.  It was actually stored in your account and only  
>> appeared to
>> be in c:\windows.  NOW put a php.ini in there.
>
> This looks like a good vista walk-through for you.
>
> http://senese.wordpress.com/2007/06/06/install-php-5-under-apache-22-and-windows-vista/
>
> Hint, read the comments if you have problems.

Dude, old timer here trying to help out. You need to put things in  
place to capture errors so you know where the problem is.
http://us.php.net/mysqli_connect

  $cxn = mysqli_connect($host,$user,$password);

Followed by:
if (!$cxn) {
     die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';


and do this every time you make a db query.

And consider using  a db class. I personally use pear because it's  
quick and consistantly deployable.
Look at:
http://pear.php.net/package/MDB2/

others will have their favorite class abstraction's but in the long  
run it doesn't matter that much but having error trapping is going to  
become important to you if you want to access db's.

Your current problem may be apache conf but without stopping on php  
code problems you won't know that it's not something php or mysql is  
halting on. And assuming your in dev turn php error_reporting to E_ALL.

Your on your way and good luck.

//Brad

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message