您正在查看: Other 分类下的文章

php 安装apache2 + php7.0并支持 MongoDB扩展支持

由于要做个EOS浏览器,展示MongoDb的数据so...

开始安装PHP运行环境

安装apache2

sudo apt-get install apache2

安装php7

sudo apt-get install php7.0

安装apache2 php7 module

sudo apt-get install libapache2-mod-php7.0

测试apache工作是否是正常


下面开始安装mongo-php-driver

从github获取最新版本mongo-php-driver的下载地址
开始下载

root@iZ2zea5mjpcmz9m17k56daZ:~# wget https://github.com/mongodb/mongo-php-driver/releases/download/1.5.1/mongodb-1.5.1.tgz

下载完毕后解压

root@iZ2zea5mjpcmz9m17k56daZ:~# tar -zxf mongodb-1.5.1.tgz 

进入安装目录

root@iZ2zea5mjpcmz9m17k56daZ:~# cd mongodb-1.5.1/

开始编译

root@iZ2zea5mjpcmz9m17k56daZ:~/mongodb-1.5.1# phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012

如果提示The program 'phpize' is currently not installed先执行安装

root@iZ2zea5mjpcmz9m17k56daZ:~/mongodb-1.5.1# phpize
The program 'phpize' is currently not installed. You can install it by typing:
apt install php7.0-dev
root@iZ2zea5mjpcmz9m17k56daZ:~/mongodb-1.5.1# apt-get install php7.0-dev

继续执行编译

./configure
make && make install

修改当前使用php配置文件,添加mongodb.so扩展配置

vim /etc/php.ini
extension=mongodb.so

重启php-fpm服务

sudo service php7.0-fpm restart & service appache2 restart

在/var/www/html/中新建test.php进行测试

<?php
// http://php.net/manual/en/class.mongodb-driver-manager.php
$manager = new MongoDB\Driver\Manager();
echo '<pre>';
var_dump($manager);
echo '</pre>';
exit;

查看网址此文件返回如下,及配置完成

object(MongoDB\Driver\Manager)#1 (2) {
  ["uri"]=>
  string(20) "mongodb://127.0.0.1/"
  ["cluster"]=>
  array(1) {
    [0]=>
    array(11) {
      ["host"]=>
      string(9) "127.0.0.1"
      ["port"]=>
      int(27017)
      ["type"]=>
      int(0)
      ["is_primary"]=>
      bool(false)
      ["is_secondary"]=>
      bool(false)
      ["is_arbiter"]=>
      bool(false)
      ["is_hidden"]=>
      bool(false)
      ["is_passive"]=>
      bool(false)
      ["tags"]=>
      array(0) {
      }
      ["last_is_master"]=>
      array(0) {
      }
      ["round_trip_time"]=>
      int(-1)
    }
  }
}

  • 查看当前php使用的php.ini
    终端输入 php --ini查看Loaded Configuration File

  • 打开PHP Error输出
    打开当前使用 php.ini 修改 display_errors = On

  • PHP log目录 /var/log/apache2

  • 查看PHP版本 php -v

  • 查看PHP扩展目录 php -i | grep extension_dir

  • 相关推荐:Ubuntu彻底删除PHP7.0
    mongodb_and_php7

Cordova Android安全指南

内容安全政策

控制允许进行哪些网络请求(图像,XHR等)(直接通过webview)。

在Android和iOS上,网络请求白名单(见上文)无法过滤所有类型的请求(例如<video>,WebSockets未被阻止)。因此,除白名单外,您还应在所有网页上使用内容安全策略 <meta>标记。

在Android上,系统webview中对CSP的支持始于KitKat(但在使用Crosswalk WebView的所有版本上都可用)。

以下是您的.html网页的一些示例CSP声明:

<!-- Good default declaration:
    * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
    * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
    * Disables use of eval() and inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
        * Enable inline JS: add 'unsafe-inline' to default-src
        * Enable eval(): add 'unsafe-eval' to default-src
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">
<!-- Allow everything but only from the same origin and foo.com -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com">
<!-- This policy allows everything (eg CSS, AJAX, object, frame, media, etc) except that 
    * CSS only from the same origin and inline styles,
    * scripts only from the same origin and inline styles, and eval()
-->
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
<!-- Allows XHRs only over HTTPS on the same domain. -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https:">
<!-- Allow iframe to https://cordova.apache.org/ -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'self' https://cordova.apache.org">

http://blog.inching.org/Cordova/2016-07-18-cordova-android-security-guide.html

ubuntu搭建个人WDCP

1. 下载wdcP

wget http://dl.wdlinux.cn/files/lanmp_v3.tar.gz

2. 解压

tar -xzvf lanmp_v3.tar.gz

3. 编译

sudo sh lanmp.sh

如果出现以下错误

编译中,开始报错:81: [: !=: unexpected operator 类似这样的编译错误,各种操作符不允许,不识别!

解决此问题的方法

sudo dpkg-reconfigure dash


选择 <NO>
然后再次编译,这个过程会很长,大概15分钟的样子~

OK,这个时候测试一下:
浏览器输入http://本地ip:8080
访问后台

默认用户名: admin
默认密码: wdlinux.cn

'elm-app' is not recognized as an internal or external command

npm i -g create-elm-app

'elm-install' is not recognized as an internal or external command

npm:

npm install elm-github-install -g

If you are experiencing EACCES: permission denied errors during installation using NPM then you can try:

sudo npm i -g elm-github-install --unsafe-perm=true --allow-root

参考来源