PHP Notes – Install with IIS

PHP Notes – Install with IIS

HashFlare

现在多数的论坛及cms基本都是php的,所以逼老子开始在win8上面玩玩php了,我先没去折腾apache,直接在iis上面玩 win8.1+iis8+php-5.5.13-nts-Win32-VC11-x64+mysql-5.5.37-winx64.msi

一、安装

iis安装时勾选CGI,

下载这个版本,重命名php.ini,改内容,扔到c/windows

extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll

fastcgi.impersonate = 1 fastcgi.logging = 0 cgi.fix_pathinfo=1 cgi.force_redirect = 0

图 1

New iPhone 6 arrived today

然后phpinfo出来一堆看不懂的东西,其实没有耐心看,为下面浪费时间埋下隐患

然后开始安装mysql,一路next,完了之后根据网上教程,测试mysql_connect,直接是call undefined function,然后各种找,后来在php目录的news里面才看到,php5已经不再用mysql_connect了,以后还是要直接看w3schools比较靠谱,里面都是最新的至少是可以用的,然后换成mysqli_connect,同样的错误?疑惑不解,然后重新下载nts的php,放在c盘下,目录也简化为php,改掉windows下面php.ini,extension_dir = “C:\php\ext”,改环境变量,copy mysql/lib dll去system32,甚至是ext下面的东西,也放到了syswow64,iisreset /restart好多遍,仍然不行,回头看phpinfo,发现Loaded Configuration File目录不对呀,怎么还是我很早之前的thread safe版本的php下面的php.ini,哦 原来我忘记更改iis的handler mapping,真是煞笔啊,而且我本来就不该去偷懒直接更改php下面的php.ini-development,好了 浪费了老子几个小时,不过发现网上一堆跟我一样的煞笔问着同样的问题,但是这种煞笔问题一般是不会有正确答案的,还是老老实实的根据php的引导来做比较好

二、开发工具

WebMatrix + Navicat for MySQL
PhpStudy

wamp https://www.virendrachandak.com/techtalk/creating-multiple-virtual-websites-in-wampserver/

三、奇葩问题

帝国备份&php.ini

帝国备份 使用时会出现 Parse error: parse error in /class/function.php on line 1246 ,
问题原因:PHP.ini 中的 short_open_tag 短标签没有设置为ON 。导致不支持该文件中的PHP短标签导致帝国备份王 ebak无法正常使用,
解决办法:打开 php.ini ,找到 short_open_tag = Off 这一行,将 Off 修改为 On,保存退出重启 Apache/ 重启iis 就可以了

php .htaccess check is working or not

 

class Car{
var $color;
private $price;
private $brand;
private $fuck=”fuck you”;

function Car($color=’white’){
$this->color=$color;
}
function __get($name){ //此处的$name只是一个参数 不要被迷惑
if(isset($this->name)){
return $this->name;
}
else
return NULL;
}

function __set($name,$value){
$this->name=$value;
}

function SetPro($name,$value){
$this->name=$value;
}

function TestDollar($name=”fuck”){
if((string)$name == “brand”){

echo “\n $ this – > name\n”;
echo $this->name;

echo “\n $ this – > $name\n”;
echo $this->$name;
}else{
echo “\n $ this – > name\n”;
echo $this->name;

echo “\n $ this – > $name\n”;
echo $this->$name; //此处是先取$name这个局部变量的值’fuck’ 然后变成$this->’fuck’ 等价于$this->fuck
}
}
}
function print_vars($object){
foreach(get_object_vars($object) as $prop=>$value){
echo “Prop:$prop”,” Value:$value”;
}
}
echo ”

TEST, PHP!

\n”;
$mycar=new Car();
print_vars($mycar);

$mycar->price=500;
echo “\n price: $mycar->price”;

$mycar->brand= ‘brand beijing’;
echo $mycar->brand;

$mycar->TestDollar(); //此处会先打出上一个设置的对象属性的值,因为用了get set,所以最近一次的属性就是$this->name
?>
XML

$string = <<<XML

Joe
Jane

I know that’s the answer — but what’s the question?

XML;

$xml = simplexml_load_string($string);

print_r($xml);
?>

The above example will output:

SimpleXMLElement Object
(
[title] => Forty What?
[from] => Joe
[to] => Jane
[body] =>
I know that’s the answer — but what’s the question?
)


$string='2用户名或密码错误';
$xml = simplexml_load_string($string);

if($xml->errorstatus->error1[0]==null){
echo ‘no error1’;
}
if($xml->errorstatus->error[0].PHP_EOL>0){
echo $xml->errorstatus->error[0].PHP_EOL;
}
?>

Basic SimpleXML usage

 

Strict Standards: Only variables should be passed by reference

http://stackoverflow.com/questions/9848295/strict-standards-only-variables-should-be-passed-by-reference-error

 

友荐云推荐