?
Solved

PHP/MYSQL on IIS 7.5

Posted on 2014-04-24
14
Medium Priority
?
671 Views
Last Modified: 2014-04-28
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
0
Comment
Question by:thomasm1948
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
14 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 40021287
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 ?
0
 

Author Comment

by:thomasm1948
ID: 40021294
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
0
 

Author Comment

by:thomasm1948
ID: 40021297
I set everyone to have full control for testing
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 29

Expert Comment

by:becraig
ID: 40021483
Can you click the arrow in IE when you get the site cannot be displayed message, so we can get the exact error .
0
 

Author Comment

by:thomasm1948
ID: 40023623
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
0
 
LVL 29

Expert Comment

by:becraig
ID: 40023639
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.
0
 

Author Comment

by:thomasm1948
ID: 40026991
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
0
 

Author Comment

by:thomasm1948
ID: 40027000
attached are the screen shots of the user's permissions.  I am new to MySQL believe these are correct
User.JPG
UserPermissions.JPG
0
 

Author Comment

by:thomasm1948
ID: 40027042
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)
0
 

Author Comment

by:thomasm1948
ID: 40027154
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
0
 
LVL 29

Expert Comment

by:becraig
ID: 40027204
It would help to see the code here.

The errors are referencing aspects of your code I cannot see.
0
 

Author Comment

by:thomasm1948
ID: 40027397
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);
}
0
 
LVL 29

Accepted Solution

by:
becraig earned 1500 total points
ID: 40027554
This seems like a variable being passed in, is a single value and not an array of values as it is expecting.

If it is pulling this info from a DB please check the values being populated from the DB to see if there is more than on (if any) being returned.
0
 

Author Closing Comment

by:thomasm1948
ID: 40027763
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);
} }
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question