【【【【日常问题记录】】】】

1.虚拟机复制后,更改的相关配置

     答:1.重新分配mac地址,点击网络适配器--高级--重新分配mac。

       2.linux里的设置:

       2.1 更改/etc/udev/rule.d/70-perxxxx-net.rules文件,只保留最后的一个,把eth1改成eth0,记住mac

       2.2 更改/etc/sysconfig/network-script/ifcfg-eth0,把HWADDR改成刚才的mac

       2.3 重启

2.yum安装mysql,php增加mysql扩展的时候,提示找不到mysql  handle

  答:ln -s  /usr/lib64/mysql/libmysqlclient.so.16.0.0    /usr/lib/libmysqlclient.so

          --with-mysql=/usr

2.1继续安装pdo_mysql扩展

  进入pdo_mysql目录下,phpize, 

  ./configure --with-php-config=/usr/lib64/php/bin/php-config --with-pdo-mysql=/usr/

3.php编译的时候一般配置

./configure   
--prefix=/usr/lib64/php
--enable-mbstring  
--enable-soap  
--enable-fpm  
--enable-maintainer-zts  
-enable-inline-optimization  
--enable-pcntl  
--with-openssl  
--with-curl  
-enable-sockets=shared  
--with-mysql=shared,mysqlnd
--enable-opcache
--enable-ftp

 

4. composer中国镜像

  答:https://toran.reimu.io/      http://packagist.jp/    http://composer-proxy.jp/  

5. linux修改环境变量

   /etc/profile   export PATH=$PATH:$JAVA_HOME/bin:~/.composer/vendor/bin

  source  /etc/profile

6.php安装mcrpyt扩展

   答:首先需要安装libcrypt,如果是yum安装的libcrypt,则还要安装libcrypt-devel

  

  1. #使用wget可以通过以下路径下载  
  2. wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz  
  3.    
  4. #解压  
  5. tar -zxvf libmcrypt-2.5.7.tar.gz   
  6.    
  7. #进入目录  
  8. cd libmcrypt-2.5.7  
  9.    
  10. #编译(默认安装到/usr/local/lib/)  
  11. ./configure --prefix=/usr/local/libmcrypt  
  12.    
  13. #执行安装  
  14. make && make install 

  再回到PHP-5.5.13解压缩的ext目录的mcrypt里面

    1. phpize  
    2.   
    3. ./configure --with-php-config=/usr/local/php5/bin/php-config \  
    4.   
    5. --with-libmcrypt=/usr/lib/libmcrypt  
    6.   
    7. make  
    8.   
    9. make test  
    10.   
    11. make install  
    12.   
    13. vim /etc/php.ini    
    14.   
    15. #加入extension=mcrypt.so 

7.命名空间理解

 答:命名空间不会自动加载!!!因此需要用某个命名空间时,要包含进来,或者自动加载

   作用:一个命名空间就相当于一个大的房间(文件夹),在里面可以定义任何名称的方法(文件),在A文件里包含后,如果A文件里有和命名空间中相同的方法,是不会冲突的,如果没有命名空间,就会冲突;

8.遮罩层快速实现

 

 1 <style type="text/css">
 2     #bg{ display: none;  position: absolute;  top: 0%;  left: 0%;  width: 100%;  height: 100%;  background-color: black;  z-index:1001;  -moz-opacity: 0.7;  opacity:.70;  filter: alpha(opacity=70);}
 3     #show{display: none;  position: absolute;  top: 25%;  left: 22%;  width: 53%;  height: 49%;  padding: 8px;  border: 8px solid #E8E9F7;  background-color: white;  z-index:1002;  overflow: auto;}
 4 </style>
 5 <div id="bg"></div>
 6 <div id="show">测试
 7     <input id="btnclose" type="button" value="Close" onclick="hidediv();"/>
 8 </div>
 9 
10 <script language="javascript" type="text/javascript">
11         function showdiv() {
12             document.getElementById("bg").style.display ="block";
13             document.getElementById("show").style.display ="block";
14         }
15         function hidediv() {
16             document.getElementById("bg").style.display ='none';
17             document.getElementById("show").style.display ='none';
18         }
19 </script>

 9. 安装pdo_mysql扩展

  ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/data/mysql/bin/mysql_config

10.MySQL int型长度

    最近在使用mysql时才真正搞清楚int(11)中11的真正含义,以前只是简单的以为是用来表示存储最大为11位长的整数,其实没有那么简单,

  int类型规定只占用4个字节,最长也就是32位,当用有符号数表示时最大值为2147483647,无符号数表示时最大值位4294729693,

  由此可见,这个数字只是指定最大显示长度,所以int(10)、int(11)、int(12)应该没有什么区别,因为最大数值也就是10位。
      另外,如果用php中的intval转换mysql中的int(11)表示的数值时,最大也只能转换2147483647,再大的话就会溢出。看来php和mysql还是一致的。

 

11.unix环境高级编程apue

  apue.h头文件为作者自己编写而非系统自带,故需要自行添加!
  第一:打开网站 http://www.apuebook.com/
  第二:选择合适的版本(一共有三个版本,根据书的版本选择)下载源码source code
        解压: tar -zxvf src.2e.tar.gz
        得到apue.2e
        复制apue.h 到 /usr/include/下: cp ./apue.2e/include/apue.h  /usr/include/
        复制error.c 到 /usr/include/下: cp ./apue.2e/lib/error.c  /usr/include/
  第三:编辑/usr/include/apue.h文件
        在文件最后#endif前加上包含error.c代码: #include "error.c"

 

12.一般php配置php.ini

   1.1.最大上传限制,最大post限制要修改
   1.2.session失效时间,默认是24分钟,如果页面24分钟内不刷新,就会失效,要改下时间
 
13.中文截取
 function utf8Substr($str, $from, $len)
    {
        return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
            '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
            '$1',$str);
    }

 

14.常用端口占用

21      ftp

22   ssl

23   telnet

80   web

3306  mysql

6379  redis

9000  php-fpm

4730  gearman

 

15.ASCII字符可以以\x##形式的十六进制表示,

  '\x41' 完全等同于 'A'

  用\u####表示一个Unicode字符:

'\u4e2d\u6587'; // 完全等同于 '中文'

16.rsa公钥私钥生成

genrsa -out rsa_private_key.pem 1024 生成私钥
rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem 生成公钥

17.nginx安装ssl模块
configure时要指定开启ssl,而且需要依赖openssl
./configure --with-http_ssl_module --with-openssl=/home/kang/Downloads/openssl-1.0.1s
openssl地址不是安装目录,是源码目录
posted @ 2015-04-24 11:18  悲惨的大爷  阅读(264)  评论(0编辑  收藏  举报