php笔记

作者: codinger | 来源:发表于2017-01-19 22:48 被阅读35次

    Composer在windows下的安装使用

    Composer是 PHP 用来管理依赖(dependency)关系的工具。你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件。
    官网:https://getcomposer.org/
    中文相关网站:http://www.phpcomposer.com/
    一、下载安装文件安装,https://getcomposer.org/Composer-Setup.exe
    二、在php.ini文档中打开extension=php_openssl.dll
    三、下载php_ssh2.dll、php_ssh2.pdb,http://windows.php.net/downloads/pecl/releases/ssh2/0.12/
    四、把php_ssh2.dll、php_ssh2.pdb文件放php的ext文件夹
    五、重启nginx及php
    六、执行cmd,运行:composer -V 能看到版本,表示安装成功

    33 配置wampserver

    http://jingyan.baidu.com/article/2fb0ba409c252100f2ec5f3a.html

    权限问题配置 permission

    listen 8081
    <VirtualHost *:8081>
        ServerName localhost
        DocumentRoot C:/Hirson/wamp64/www/zhibo
        <Directory  "C:/Hirson/wamp64/www/zhibo">
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        allow from all
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
         DocumentRoot "C:\wamp\www"      
         ServerName localhost       
    </VirtualHost>
    
    
    listen 88
    <VirtualHost *:88> 
    ServerAdmin webmaster@dummy-host2.example.com
     DocumentRoot "C:/wamp/www/test" 
    ServerName www.123.com 
    <Directory "C:/wamp/www/test">
    Options Indexes FollowSymLinks
        AllowOverride None
    </Directory>
    </VirtualHost>
    

    在Apache2.4下面会出现403的问题

    You don't have permission to access / on this server. Apache/2.4.18 (Win32)

    需要设置
    require all granted

    listen 8050
    <VirtualHost *:8050> 
    ServerAdmin webmaster@dummy-host2.example.com
     DocumentRoot "E:/web/TP5_Splider" 
    ServerName www.123.com 
    <Directory "E:/IIS_web/TP5_Splider">
         Options Indexes FollowSymLinks  
         AllowOverride None
         Order deny,allow
         allow from all
         require all granted
    </Directory>
    </VirtualHost>
    

    apache 配置接口代理

    • 1.找到Apache目录下的httpd.conf文件,将
      LoadModule proxy_module modules/mod_proxy.so和
      LoadModule proxy_http_module modules/mod_proxy_http.so前的注释去掉、
    • 2 配置信息
     <VirtualHost *:80>  
           ServerAdmin test@test.com  
           ServerName www.test.com  
      
           ProxyRequests Off  
      <Proxy *>  
           Order deny,allow  
           Allow from all  
       </Proxy>  
           ProxyPass /test    http://192.168.1.2:8080/test  
           ProxyPassReverse /test   http://192.168.1.2:8080/test  
    </VirtualHost>  
    

    接口代理

     
    <?php
    
        header('Content-Type:text/json;charset=utf-8');//设置返回文件的类型
        header('Access-Control-Allow-Origin: *');//设置允许所有跨域
        $url= $_SERVER['REQUEST_URI']; //获取url localhost后面部分
            if($url=='/'){
            $arrs["msg"]="请填写你要请求的参数apiProxy=";
            echo json_encode($arrs);
            die();
        }else{
            $arr=explode('apiProxy=',$url); 
            if($arr[1]== null){
            $arrs["msg"]="代理参数请求错误";
            echo json_encode($arrs);
            die();
        }
            $data =file_get_contents($arr[1]);
            echo $data;
        }
        
     
    

    相关文章

      网友评论

          本文标题:php笔记

          本文链接:https://www.haomeiwen.com/subject/ulqwbttx.html