I am trying to install php on my local machine. I have xp pro sp2. I have VS2005 with SQL Express and .net1.1 and 2.0 set up.
I ran the php install program and it seemed to install without any probs, however when I try to browse to localhost....Test.php, I get asked if I want to download the file. For some reason IIS isn't recognising PHP.
You will also have use goto IIS admin click Default Website > properties> Document tab and enter the name of the PHP page to goto to start. Example: index.php, default.php
Sounds like you aren't far off. If you can't get it sorted it might be easier just to configure IIS to use PHP in ISAPI mode. Details are in the guide I linked to above.
----------------
Dominic Ryan
Microsoft IIS MVP
IIS Aid IIS and Open Source
I have been using net and web development since 2002 and I am surprised to think now that I have never participated in any forum till. All i do i read other's
posts and get help.I have been using asp asp.net always. But I needed some programs which are not easily available in asp. Like forum, affiliation scripts etc.All
they are at unaffordable prices for me in asp.But I got in php at sudden affordable price. I have been searching and browsing for 26 days to run php in iis5.1 but I till not got full success.What
I did is, I downloaded zip file of php_win32_XXX.zip (what ever it be) and tried to install with confidence as I have worked much with asp. But I got know soon that it is not so easy. After all I deleted that zip file and downloaded installer version of php.
It not only installed easily but also I glad to work with php files easily. But this glad proof temporary when I tried to connect the php file with sql database. I tried much but failed.The php file runs
smoothly but when I enter username and password to proceed it showed error. Then I downloaded phpmyadmin but could not install it on iis. So I search online demo and used it onhttp://pma.cihar.com/QA_2_11/index.php?db=phpmyadmin&server=1&target=db_structure.php&token=beeeb3cf04e2f59e8255ae989d019b3dAnd
made a database named databas1.sql which is still their in online demo. I exported it and tried to run but failed.Now I am going to disappointed from
php. But for last try I have joined this forum for the first time joining forum in my life.Please help me if some one can do so.I am using iis5.1
, php-5.2.4-win32-installer and mysql5.0.45 (command line).When ever I try to access databas1.sql through index.php it shows following error.("localhost/phpaf/user/admin/index.php" )Fatal
error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\phpaf\user\admin\index.php on line 13
I have already entered php.exe in iis manager and it shows .php extension.And also have copied php_mysql.dll, php_mysqli.dll in c:\program files\php from
c:\program files\php\extPlease tell me some thing to fix this problem if any one knows.index.php_________________________<?PHP
session_start();
include "../../affconfig.php";
include "../lang/$language";if ($_POST['userid']!='' && $_POST['password']!='')
{
// protection against script injection
$userid = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['userid']);
$password = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['password']);
// if the user has just tried to log in
$db_conn = mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 11)");
mysql_select_db($database, $db_conn); $query = "select * from admin where user='$userid' and pass='$password'";
$result = mysql_query($query, $db_conn);
if (mysql_num_rows($result) >0 )
{
// if they are in the database register the user id
$_SESSION['aff_valid_admin'] = $userid;
// logout user if he was logged in before
$_SESSION['aff_valid_user'] = '';
unset($_SESSION['aff_valid_user']);
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=0;URL=index2.php>";
exit;
}
}
include "header.php";
if(aff_admin_check_security())
{
aff_redirect('index2.php');
exit;
}
else
{
if (isset($_POST['userid']))
{
// if they've tried and failed to log in
echo AFF_I_CANNOTLOG;
}
else
{
// they have not tried to log in yet or have logged out
echo AFF_I_NOTLOGGED;
} // provide form to log in
?>
<form method=post action="index.php">
<table align=center border=0>
<tr><td><?=AFF_G_USERNAME?>:</td>
<td><input type=text name=userid></td></tr>
<tr><td><?=AFF_G_PASSWORD?>:</td>
<td><input type=password name=password></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Log in"></td></tr>
</table></form>
<?
}
?>
</p>
<br>
<?PHP
include "footer.php";
?>
_____________________________________databas1.sql _______________________________________--
phpMyAdmin SQL Dump
-- version 2.11.3-dev
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 23, 2007 at
10:29 PM
-- Server version: 5.0.45
-- PHP Version: 5.2.4-1SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";--
-- Database: `database1`
---- ----------------------------------------------------------
-- Table structure for table `admin`
--CREATE TABLE IF NOT EXISTS `admin` (
`user` varchar(100) NOT NULL default '',
`pass` varchar(100) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `admin`
--INSERT INTO `admin` (`user`, `pass`) VALUES
('admin', 'mypc');-- ----------------------------------------------------------
-- Table structure for table `affiliates`
--CREATE TABLE IF NOT EXISTS `affiliates` (
`refid` varchar(30) NOT NULL default '',
`pass` varchar(20) NOT NULL default '',
`company` varchar(100) NOT NULL default '',
`title` varchar(5) NOT NULL default '',
`firstname` varchar(40) NOT NULL default '',
`lastname` varchar(40) NOT NULL default '',
`website` varchar(100) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`payableto` varchar(100) NOT NULL default '',
`street` varchar(100) NOT NULL default '',
`town` varchar(100) NOT NULL default '',
`county` varchar(100) NOT NULL default '',
`postcode` varchar(20) NOT NULL default '',
`country` varchar(100) NOT NULL default '',
`phone` varchar(30) NOT NULL default '',
`fax` varchar(30) NOT NULL default '',
`date` varchar(40) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `affiliates`
--
-- ----------------------------------------------------------
-- Table structure for table `banners`
--CREATE TABLE IF NOT EXISTS `banners` (
`number` int(3) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`image` varchar(60) NOT NULL default '',
`description` varchar(200) NOT NULL default '',
PRIMARY KEY (`number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;--
-- Dumping data for table `banners`
--
-- ----------------------------------------------------------
-- Table structure for table `clickthroughs`
--CREATE TABLE IF NOT EXISTS `clickthroughs` (
`refid` varchar(20) default 'none',
`date` date NOT NULL default '0000-00-00',
`time` time NOT NULL default '00:00:00',
`browser` varchar(200) default 'Could Not Find This Data',
`ipaddress` varchar(50) default 'Could Not Find This Data',
`refferalurl` varchar(200) default 'none detected (maybe a direct link)',
`buy` varchar(10) default 'NO'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `clickthroughs`
--
-- ----------------------------------------------------------
-- Table structure for table `sales`
--CREATE TABLE IF NOT EXISTS `sales` (
`refid` varchar(20) NOT NULL default '',
`date` date NOT NULL default '0000-00-00',
`time` time NOT NULL default '00:00:00',
`browser` varchar(100) NOT NULL default '',
`ipaddress` varchar(20) NOT NULL default '',
`payment` varchar(10) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `sales`
--___________________________________________________Thanks a lotPlease
let me know if you want any other information.Best RegardMuaaz
Easiest way to verify that the MySQL extension is loaded is to use the phpinfo function. Place this in a file called something like phpinfo.php and place it in your website root;
<?php
phpinfo();
?>
Access the page through your browser and do a search for MySQL.
----------------
Dominic Ryan
Microsoft IIS MVP
IIS Aid IIS and Open Source
//-------------------------------------------------------------------------------
// CONFIGURATION OPTIONS
//-------------------------------------------------------------------------------
// Your domain name (include www. if used BUT NOT http://)
$domain = "localhost/mysite";
// Your MySQL server address (usually 'localhost')
$server = "localhost";
// Your MySQL database username
$db_user = "mydatabase";
// Your MySQL database password
$db_pass = "protect321";
// Your MySQL database name
$database = "mydatabase";
// cookie expiration in days. If 0, it is "unlimited" (set to 10 yrs)
$cookieExpiration = 0;
// cookie path, should be always '/'
$cookiePath = '/';
//-------------------------------------------------------------------------------
// DO NOT MODIFY ANYTHING BELOW THIS POINT UNLESS
// YOU KNOW WHAT YOU ARE DOING
//-------------------------------------------------------------------------------
$clientdate = (date ("Y-m-d")); // Do Not Touch
$clienttime = (date ("H:i:s")); // Do Not Touch
$clienturl = getenv("HTTP_REFERER"); // Do Not Touch
function aff_redirect($url, $time = 0)
{
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$time;URL=$url\">";
echo "If you will be not redirected within few seconds click <a class=leftLink href=$url>".here.'</a>';
}
chemystery
1 Post
Installing PHP on iis 5.1
Nov 21, 2006 06:33 AM|LINK
Hi,
I am trying to install php on my local machine. I have xp pro sp2. I have VS2005 with SQL Express and .net1.1 and 2.0 set up.
I ran the php install program and it seemed to install without any probs, however when I try to browse to localhost....Test.php, I get asked if I want to download the file. For some reason IIS isn't recognising PHP.
What else do I need to do to get it running?
Many Thanks!
ganeshanekar
551 Posts
Re: Installing PHP on iis 5.1
Nov 21, 2006 04:52 PM|LINK
Can you check following -
Right Click Default Website > Properties> Home directory > Configuration>
Under Application Mappings - Do you see .php is added - If yes - is it pointing to php.exe?
You should see entry like this - Extension - .php Executable Path - c:\php\php.exe %s %s
Thanks!
Ganesh
wxwitch
16 Posts
Re: Installing PHP on iis 5.1
Dec 26, 2006 04:30 AM|LINK
wxwitch
16 Posts
Re: Installing PHP on iis 5.1
Dec 26, 2006 04:36 AM|LINK
Check this site out, it saved me a lot of time and I don't want to take credit for some elses hard work.
http://www.sitepoint.com/article/php-amp-mysql-1-installation/2
I think it may help you out.
brashquido
396 Posts
Moderator
Re: Installing PHP on iis 5.1
May 04, 2007 02:37 PM|LINK
I've also written an install guide here;
Installing PHP 5 on IIS in 5 simple steps
Sounds like you aren't far off. If you can't get it sorted it might be easier just to configure IIS to use PHP in ISAPI mode. Details are in the guide I linked to above.
Dominic Ryan
Microsoft IIS MVP
IIS Aid
IIS and Open Source
muaazab
3 Posts
Problem in Installing PHP on iis 5.1
Oct 24, 2007 02:52 PM|LINK
Hi all
I am new in php.
I have been using net and web development since 2002 and I am surprised to think now that I have never participated in any forum till. All i do i read other's posts and get help.I have been using asp asp.net always. But I needed some programs which are not easily available in asp. Like forum, affiliation scripts etc.All they are at unaffordable prices for me in asp.But I got in php at sudden affordable price. I have been searching and browsing for 26 days to run php in iis5.1 but I till not got full success.What I did is, I downloaded zip file of php_win32_XXX.zip (what ever it be) and tried to install with confidence as I have worked much with asp. But I got know soon that it is not so easy. After all I deleted that zip file and downloaded installer version of php. It not only installed easily but also I glad to work with php files easily. But this glad proof temporary when I tried to connect the php file with sql database. I tried much but failed.The php file runs smoothly but when I enter username and password to proceed it showed error. Then I downloaded phpmyadmin but could not install it on iis. So I search online demo and used it onhttp://pma.cihar.com/QA_2_11/index.php?db=phpmyadmin&server=1&target=db_structure.php&token=beeeb3cf04e2f59e8255ae989d019b3d And made a database named databas1.sql which is still their in online demo. I exported it and tried to run but failed.Now I am going to disappointed from php. But for last try I have joined this forum for the first time joining forum in my life.Please help me if some one can do so.I am using iis5.1 , php-5.2.4-win32-installer and mysql5.0.45 (command line).When ever I try to access databas1.sql through index.php it shows following error.("localhost/phpaf/user/admin/index.php" )Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\phpaf\user\admin\index.php on line 13
I have already entered php.exe in iis manager and it shows .php extension.And also have copied php_mysql.dll, php_mysqli.dll in c:\program files\php from c:\program files\php\extPlease tell me some thing to fix this problem if any one knows.index.php_________________________<?PHPsession_start();
include "../../affconfig.php";
include "../lang/$language";if ($_POST['userid']!='' && $_POST['password']!='')
{
// protection against script injection
$userid = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['userid']);
$password = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['password']);
// if the user has just tried to log in
$db_conn = mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 11)");
mysql_select_db($database, $db_conn); $query = "select * from admin where user='$userid' and pass='$password'";
$result = mysql_query($query, $db_conn);
if (mysql_num_rows($result) >0 )
{
// if they are in the database register the user id
$_SESSION['aff_valid_admin'] = $userid;
// logout user if he was logged in before
$_SESSION['aff_valid_user'] = '';
unset($_SESSION['aff_valid_user']);
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=0;URL=index2.php>";
exit;
}
}
include "header.php";
if(aff_admin_check_security())
{
aff_redirect('index2.php');
exit;
}
else
{
if (isset($_POST['userid']))
{
// if they've tried and failed to log in
echo AFF_I_CANNOTLOG;
}
else
{
// they have not tried to log in yet or have logged out
echo AFF_I_NOTLOGGED;
} // provide form to log in
?>
<form method=post action="index.php">
<table align=center border=0>
<tr><td><?=AFF_G_USERNAME?>:</td>
<td><input type=text name=userid></td></tr>
<tr><td><?=AFF_G_PASSWORD?>:</td>
<td><input type=password name=password></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Log in"></td></tr>
</table></form>
<?
}
?>
</p>
<br>
<?PHP
include "footer.php";
?>
_____________________________________databas1.sql _______________________________________-- phpMyAdmin SQL Dump
-- version 2.11.3-dev
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 23, 2007 at 10:29 PM
-- Server version: 5.0.45
-- PHP Version: 5.2.4-1SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";--
-- Database: `database1`
---- ----------------------------------------------------------
-- Table structure for table `admin`
--CREATE TABLE IF NOT EXISTS `admin` (
`user` varchar(100) NOT NULL default '',
`pass` varchar(100) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `admin`
--INSERT INTO `admin` (`user`, `pass`) VALUES
('admin', 'mypc');-- ----------------------------------------------------------
-- Table structure for table `affiliates`
--CREATE TABLE IF NOT EXISTS `affiliates` (
`refid` varchar(30) NOT NULL default '',
`pass` varchar(20) NOT NULL default '',
`company` varchar(100) NOT NULL default '',
`title` varchar(5) NOT NULL default '',
`firstname` varchar(40) NOT NULL default '',
`lastname` varchar(40) NOT NULL default '',
`website` varchar(100) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`payableto` varchar(100) NOT NULL default '',
`street` varchar(100) NOT NULL default '',
`town` varchar(100) NOT NULL default '',
`county` varchar(100) NOT NULL default '',
`postcode` varchar(20) NOT NULL default '',
`country` varchar(100) NOT NULL default '',
`phone` varchar(30) NOT NULL default '',
`fax` varchar(30) NOT NULL default '',
`date` varchar(40) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `affiliates`
--
-- ----------------------------------------------------------
-- Table structure for table `banners`
--CREATE TABLE IF NOT EXISTS `banners` (
`number` int(3) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`image` varchar(60) NOT NULL default '',
`description` varchar(200) NOT NULL default '',
PRIMARY KEY (`number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;--
-- Dumping data for table `banners`
--
-- ----------------------------------------------------------
-- Table structure for table `clickthroughs`
--CREATE TABLE IF NOT EXISTS `clickthroughs` (
`refid` varchar(20) default 'none',
`date` date NOT NULL default '0000-00-00',
`time` time NOT NULL default '00:00:00',
`browser` varchar(200) default 'Could Not Find This Data',
`ipaddress` varchar(50) default 'Could Not Find This Data',
`refferalurl` varchar(200) default 'none detected (maybe a direct link)',
`buy` varchar(10) default 'NO'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `clickthroughs`
--
-- ----------------------------------------------------------
-- Table structure for table `sales`
--CREATE TABLE IF NOT EXISTS `sales` (
`refid` varchar(20) NOT NULL default '',
`date` date NOT NULL default '0000-00-00',
`time` time NOT NULL default '00:00:00',
`browser` varchar(100) NOT NULL default '',
`ipaddress` varchar(20) NOT NULL default '',
`payment` varchar(10) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;--
-- Dumping data for table `sales`
--___________________________________________________Thanks a lot Please let me know if you want any other information.Best RegardMuaaz
rickjames
193 Posts
Microsoft
Re: Problem in Installing PHP on iis 5.1
Oct 24, 2007 03:47 PM|LINK
first live.com search for your error message gave the following solution: in php.ini:
- check that extension_dir is correct
- check the mysql extension dll is enable
brashquido
396 Posts
Moderator
Re: Problem in Installing PHP on iis 5.1
Oct 24, 2007 03:53 PM|LINK
Easiest way to verify that the MySQL extension is loaded is to use the phpinfo function. Place this in a file called something like phpinfo.php and place it in your website root;
<?php
phpinfo();
?>
Access the page through your browser and do a search for MySQL.
Dominic Ryan
Microsoft IIS MVP
IIS Aid
IIS and Open Source
muaazab
3 Posts
Re: Problem in Installing PHP on iis 5.1
Oct 27, 2007 01:37 AM|LINK
Thank You So Much Rickjames and brashquido
But i have deleted all things related to php sql mysql.
__________________________________________________________
But not becouse of i have dishearted and left.
because of i have installed XAMPP. And enjoing real php mysql and apache server.
again thanks to all.
Moaz
muaazab
3 Posts
Re: Problem in Installing PHP on iis 5.1
Oct 28, 2007 08:59 PM|LINK
hi all
i have a problem in my php script would any one help me please!
i am using an affiliate script for link exchange which takes the values of visitors into the database(sql) and tells the refferar upon visitors entry.
Problem is
when the visitor refreshes the page it includes another entry, how can i stop duplicating of entry.
the script is as follows.
refferer.php
____________
<?php
if($_GET['ref'])
{
if($cookieExpiration != 0)
$cookieLifetime = time() + $cookieExpiration*86400;
else
$cookieLifetime = time() + 3650*86400;
SetCookie ("ref",$_GET['ref'], $cookieLifetime, $cookiePath, $cookieDomain);
SetCookie ("ref",$_GET['ref'], $cookieLifetime, $cookiePath, $cookieDomain);
SetCookie ("ref",$_GET['ref'], $cookieLifetime, $cookiePath, $cookieDomain);
session_start();
$_SESSION['ref'] = $_GET['ref'];
include "configration.php";
mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 17)");
mysql_db_query($mydatabase, "INSERT INTO enters VALUES ('".$_GET['ref']."', '$clientdate', '$clienttime', '$clienturl', '')");
}
?>
_________________________________________________________________
configration.asp
<?PHP
//-------------------------------------------------------------------------------
// CONFIGURATION OPTIONS
//-------------------------------------------------------------------------------
// Your domain name (include www. if used BUT NOT http://)
$domain = "localhost/mysite";
// Your MySQL server address (usually 'localhost')
$server = "localhost";
// Your MySQL database username
$db_user = "mydatabase";
// Your MySQL database password
$db_pass = "protect321";
// Your MySQL database name
$database = "mydatabase";
// cookie expiration in days. If 0, it is "unlimited" (set to 10 yrs)
$cookieExpiration = 0;
// cookie path, should be always '/'
$cookiePath = '/';
//-------------------------------------------------------------------------------
// DO NOT MODIFY ANYTHING BELOW THIS POINT UNLESS
// YOU KNOW WHAT YOU ARE DOING
//-------------------------------------------------------------------------------
$clientdate = (date ("Y-m-d")); // Do Not Touch
$clienttime = (date ("H:i:s")); // Do Not Touch
$clienturl = getenv("HTTP_REFERER"); // Do Not Touch
// helper functions
function aff_check_security()
{
if(!isset($_SESSION['aff_valid_ref']) || $_SESSION['aff_valid_ref]=='')
return false;
else
return true;
}
function aff_user_check_security()
{
if(!isset($_SESSION['aff_valid_user']) || $_SESSION['aff_valid_user']=='')
return false;
else
return true;
}
function aff_redirect($url, $time = 0)
{
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$time;URL=$url\">";
echo "If you will be not redirected within few seconds click <a class=leftLink href=$url>".here.'</a>';
}
?>
_____________________________________________
is there any idea to stop duplication entry