Link to home
Start Free TrialLog in
Avatar of thomasm1948
thomasm1948Flag for United States of America

asked on

PHP/MYSQL on IIS 7.5

Hi,

I have an issue I went through the setup of PHP on IIS 7.5 and I am able to display the phpinfo.php sample file just fine.  I installed MySQL and set permissions to a user that the PHP site is using (Select, Delete, Insert, Update).

Every time I try to browse to this site I get website cannot be displayed.  I have not clue what I am doing wrong.  I added in the FastCGI ("Invoke handler only if request is mapped to: file)

There is nothing that I can see that is wrong and there is no troubleshooting messages.  I read the logs and all what it is logging is the different browsers that it supports and mine was listed

Thank you in advance
Avatar of becraig
becraig
Flag of United States of America image

I am able to display the phpinfo.php sample file just fine.

You are able to do this using the servername / ip or domain name  ?



How are you attempting to browse to this site, and are any other sites configured on this server ?

I would ask you to ensure the site you are trying to access is configured to respond to the dns/ip you are calling.   Are you calling just the site or a specific page / resource ?
Avatar of thomasm1948

ASKER

I am using http://localhost/phpinfo.php and that works.  If I use http://localhost/index.php it is redirected to one folder down http://localhost/electrical/index.php fails
I set everyone to have full control for testing
Can you click the arrow in IE when you get the site cannot be displayed message, so we can get the exact error .
The following is the error message I am getting:

This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

For more information about HTTP errors, see Help.

On IIS 7.5 Application pools and under the name it says that it is using .NET v2.0. .  I tried to set it no managed code as well and it does not work
Ok so a 500 indicates a problem with the actual app itself.

Can you change your index.php to a simple php page maybe echoing some php variables and see if it loads with no problem.

Backup a copy of your correct index.php first.
OK, I finally got the PHP errors to work correctly.  The following is the error:

Fatal error: Call to undefined function mysql_connect() in C:\inetpub\wwwroot\three_rivers_dashboard\includes\Connections\link.php on line 14

The code that I am running is:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_link = "localhost";
$database_link = "three_rivers";
$username_link = "meterdata_user";
$password_link = "PowerSaver";
#$link = mysql_pconnect($hostname_link, $username_link, $password_link) or trigger_error(mysql_error(),E_USER_ERROR);
?>


<?php
$con = mysql_connect('localhost', 'meterdata_user', 'PowerSaver');
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
//echo 'Connected successfully';
mysql_select_db(three_rivers);
mysql_close($con);
?>


From what I see it should be working
attached are the screen shots of the user's permissions.  I am new to MySQL believe these are correct
User.JPG
UserPermissions.JPG
OK, I got past the above errors but now I get new errors:


Notice: Use of undefined constant three_rivers - assumed 'three_rivers' in C:\inetpub\wwwroot\three_rivers_dashboard\includes\Connections\link.php on line 19

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\inetpub\wwwroot\three_rivers_dashboard\includes\variables.php on line 60

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\inetpub\wwwroot\three_rivers_dashboard\includes\variables.php on line 60
 Query failed: Access denied for user 'ODBC'@'localhost' (using password: NO)
OK, now I got passed those errors now I have the following:

Notice: Undefined variable: from in C:\inetpub\wwwroot\three_rivers_dashboard\electric\index.php on line 36

Notice: Undefined variable: from in C:\inetpub\wwwroot\three_rivers_dashboard\electric\index.php on line 38

Notice: Undefined variable: from in C:\inetpub\wwwroot\three_rivers_dashboard\electric\index.php on line 42

Notice: Undefined variable: from in C:\inetpub\wwwroot\three_rivers_dashboard\electric\index.php on line 49

Notice: Use of undefined constant Three_Rivers - assumed 'Three_Rivers' in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\aggregations\aggregations.php on line 3

Notice: Use of undefined constant str_table_id - assumed 'str_table_id' in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\get_required_meters_kwh_arrays.php on line 21

Notice: Use of undefined constant str_table - assumed 'str_table' in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\get_required_meters_kwh_arrays.php on line 22

Notice: Use of undefined constant str_column - assumed 'str_column' in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\get_required_meters_kwh_arrays.php on line 23

Notice: Use of undefined constant int_id_number - assumed 'int_id_number' in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\get_required_meters_kwh_arrays.php on line 24

Notice: Undefined variable: from in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\get_required_meters_kwh_arrays.php on line 41

Notice: Undefined variable: from in C:\inetpub\wwwroot\three_rivers_dashboard\electric\includes\get_required_meters_kwh_arrays.php on line 61
It would help to see the code here.

The errors are referencing aspects of your code I cannot see.
I m getting closer here are my new errors

Warning: current() [function.current]: Passed variable is not an array or object in C:\inetpub\wwwroot\three_rivers\electric\includes\aggregations\Three_Rivers.php on line 77

Warning: array_pop() [function.array-pop]: The argument should be an array in C:\inetpub\wwwroot\three_rivers\electric\includes\aggregations\Three_Rivers.php on line 93

here is the code:

while ($interval = current($interval_time)) {
   //echo '<br />interval = '.$interval;
   
   $query = mysql_query("SELECT
   (`$meter1`) +
   (`$meter2`)  Total
                  FROM`tbl_temp`
                  WHERE`dtm_interval_time`='{$interval}'");
  if (!$query) {die("Database query failed: " . mysql_error());}
  while ($row = mysql_fetch_array($query)) {
       $arrayName[] = round($row["Total"],2);
}
next($interval_time);
}
ASKER CERTIFIED SOLUTION
Avatar of becraig
becraig
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I added the following line at it seemed to clear the error:

if (is_array($interval)) {
while ($interval = current($interval_time)) {
   //echo '<br />interval = '.$interval;
   
   $query = mysql_query("SELECT
   (`$meter1`) +
   (`$meter2`)  Total
                  FROM`tbl_temp`
                  WHERE`dtm_interval_time`='{$interval}'");
  if (!$query) {die("Database query failed: " . mysql_error());}
  while ($row = mysql_fetch_array($query)) {
       $arrayName[] = round($row["Total"],2);
}
next($interval_time);
} }