赶快来升级你的浏览器吧

使用老旧浏览器会对您的计算机安全造成威胁,大部分已经开始离开!

  • Mozilla Firefox

    “Firefox 注重您的信息安全。汇聚各种全新特性,给你更好的上网体验!”

  • Safari

    “Safari 是苹果公司充满创新设计的产品,可用于 Mac 和 Windows。”

  • Opera

    “地球上最快的浏览器。安全。强大。易用。免费。”

  • Internet Explorer

    “来自微软公司的免费浏览器。全新特性助您控制个人隐私。”

发表在 软件 | 标签为 | 留下评论

Linux下修改文件创建修改时间

使用方式:
touch [-acfm]
[-r reference-file] [–file=reference-file]
[-t MMDDhhmm[[CC]YY][.ss]]
[-d time] [–date=time] [–time={atime,access,use,mtime,modify}]
[–no-create] [–help] [–version]
file1 [file2 …]
说明:
touch 指令改变档案的时间记录。 ls -l 可以显示档案的时间记录。
参数:
a 改变档案的读取时间记录。
m 改变档案的修改时间记录。
c 假如目的档案不存在,不会建立新的档案。与 –no-create 的效果一样。
f 不使用,是为了与其他 unix 系统的相容性而保留。
r 使用参考档的时间记录,与 –file 的效果一样。
d 设定时间与日期,可以使用各种不同的格式。
t 设定档案的时间记录,格式与 date 指令相同。

find . -name “*” -exec touch ‘{}’ \;

注:最后一定要加分号,{}外一定要加单引号,*表示所有的文件(. 代表当前目录下)

如果只修改单个文件

==========================================================
touch -d 和 date -s 的用法相同。如果没有指定日期,默认为系统日期
touch -d 18:03 file
touch -d “18:03” file
touch -d “6:03pm” file

如果没有指定时间,默认为 00:00:00
touch -d 20000506 file
touch -d “05/06/2000” file
touch -d “20000506” file
touch -d “6:03pm 05/06/2000” file
touch -d “20000506 18:03” file
touch -d “20000506 18:03:00” file

发表在 开源代码 | 标签为 | 留下评论

火狐 IE下关闭网页window.close的javascript代码

解决window.close在火狐下不兼容问题

<script type=”text/javascript”>
function CloseWebPage() {
if (navigator.userAgent.indexOf(“MSIE”) > 0) {
if (navigator.userAgent.indexOf(“MSIE 6.0″) > 0) {
window.opener = null; window.close();
}
else {
window.open(”, ‘_top’); window.top.close();
}
}
else if (navigator.userAgent.indexOf(“Firefox”) > 0) {
window.location.href = ‘about:blank ‘;
//window.history.go(-2);
}
else {
window.opener = null;
window.open(”, ‘_self’, ”);
window.close();
}
}
</script>

<a href=”javascript:CloseWebPage();” >关闭</a>

 

发表在 开源代码 | 标签为 , , | 留下评论

php错误日志超过2g会抛出502错误

环境阿里云:linux centos

今天追踪一个php502错误,遇到很奇怪的问题,最后发现以下代码写入错误信息到文件,

error_log(‘<?php exit;?>’.date(‘m-d H:i:s’,SYS_TIME).’ | ‘.$errno.’ | ‘.str_pad($errstr,30).’ | ‘.$errfile.’ | ‘.$errline.”\r\n”, 3, CACHE_PATH.’error_log.php’);

此时error_log.php这个文件已经超过2g,最后cat /dev/null清空它后,回复正常。

查询文档也没发现限制错误日志文件大小的相关配置。

只有这个:log_errors_max_len = 1024                   ;设置每个日志项的最大长度

发表在 服务器 | 标签为 | 留下评论

php连接mssql方式使用pdo sqlsrv扩展

Microsoft SQL Server Functions (PDO_SQLSRV)

相关介绍:http://php.net/manual/en/ref.pdo-sqlsrv.php

如:
Support for 5.5 has 4 drivers
php_pdo_sqlsrv_55_nts.dll
php_pdo_sqlsrv_55_ts.dll
php_sqlsrv_55_nts.dll
php_sqlsrv_55_ts.dll

各版本支持:

  • Version 3.2 supports PHP 5.6, 5.5, and 5.4
  • Version 3.1 supports PHP 5.5 and 5.4
  • Version 3.0 supports PHP 5.4

这里下载:

http://www.microsoft.com/en-us/download/details.aspx?id=20098

发表在 开源代码 | 标签为 | 留下评论

清除MySql命令历史记录

Mysql 在操作过程中会将命令记录在 $HOME/.mysql_history文件中

# cat > ~/.mysql_history
Ctrl+c

这样就清空了./mysql_history中的历史记录

发表在 数据库 | 标签为 | 留下评论

Centos安装SVN服务端

linuxCentos可以选择yum install subversion或源码安装 这里选择源码安装。

先到http://archive.apache.org/dist/subversion/这里下个最新版本。

找个目录

wget http://archive.apache.org/dist/subversion/subversion-1.8.13.tar.gz
tar xzf subversion-1.8.13.tar.gz
cd subversion-1.8.13
./configure –prefix=/usr/local/svn

提示没有apr之类的:configure: error: no suitable apr found
yum install apr
yum install apr-util
yum install apr-devel
yum install apr-util-devel

重新编译又提示:configure: error: Subversion requires SQLite
上http://www.sqlite.org/download.html下载个
wget http://www.sqlite.org/2015/sqlite-amalgamation-3081002.zip
解压:unzip sqlite-amalgamation-3081002.zip -d ./subversion-1.8.13/
改名:mv sqlite-amalgamation-3071501 sqlite-amalgamation

重新编译通过接着:make&make install
查看版本:/usr/local/svn/bin/svnserve –version
创建个项目:svnadmin create /data/svn/mall
运行服务端:/usr/local/svn/bin/svnserve -d –listen-port 9999 -r /data/svn
查看进程:ps -aux|grep svn

搞定

发表在 开源代码 | 标签为 , , | 留下评论

Linux修改文件和删除等Root权限都被禁止

删除修改文件都会提示 Operation not permitted

首先先查看一下属性
lsattr file
—-i——– file

然后去除i这个属性
chattr -i file

就可以删除修改了

i表示不得任意更动文件或目录

我们可以通过man chattr查看(仅摘录相关部分):

DESCRIPTION: “chattr” changes the file attributes on a Linux second extended file system.

A file with the ‘a’ attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

A file with the ‘i’ attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be  written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

发表在 开源代码 | 标签为 | 留下评论

vps阿里云linux下挂新添加的磁盘分区

阿里云linux系统新购买的磁盘是需要执行挂盘操作

硬盘分区及挂载操作步骤:

1. 查看未挂载的硬盘(名称为/dev/xvdb)

# fdisk -l 

Disk /dev/xvdb doesn’t contain a valid partition table

2. 创建分区:参数-S 56扇区对齐

# fdisk -S 56 /dev/xvdb

输入n

Command (m for help):n

输入p

Command action
e extended
p primary partition (1-4)
p

输入1

Partition number (1-4): 1

回车

First cylinder (1-2610, default 1):
Using default value 1

回车

Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):
Using default value 2610

输入w

Command (m for help): w
The partition table has been altered!

3. 格式化分区

# mkfs.ext4 /dev/xvdb1

4. 建立挂载目录

# mkdir /data

5. 挂载分区

# mount /dev/xvdb1 /data

6. 设置开机自动挂载

vi /etc/fstab

在vi中输入i进入INERT模式,将光标移至文件结尾处并回车,将下面的内容复制/粘贴,然后按Esc键,输入:x保存并退出

/dev/xvdb1  /data ext4    defaults    0  0

7. 确认是否挂载成功

重启服务器

# reboot

查看硬盘分区

# df

Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      20641404 6906728  12686152  36% /
tmpfs             960368       0    960368   0% /dev/shm
/dev/xvdb1     495415580 2489068 467760872   1% /data

发表在 服务器 | 标签为 , , | 留下评论

如何设置winscp显示隐藏文件

今天升级后登录winscp发现隐藏文件怎么都看不到了,还以为是被删除了,到命令行下查看还是存在的,后来发现默认设置被修改了,只要修改下即可,如下:

如何设置winscp显示隐藏文件

发表在 服务器 | 留下评论