Solved

PHP/MYSQL on IIS 7.5

Posted on 2014-04-24
14
629 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
  • 9
  • 5
14 Comments
 
LVL 28

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

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 28

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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 28

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 28

Accepted Solution

by:
becraig earned 500 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now