工作,学习,生活,这里将会有一些记录. 备用域名:http://meisw.wdlinux.cn 注册 | 登陆
浏览模式: 标准 | 列表全部文章

AjaxCity:Ajax 省份-城市-区县

http://www.actphp.com/ajaxcity/

squid里替换域名

请求域名:www.test.com
源服务器:www.test2.com

本来通过squid服务器用www.test.com请求正常,因为换了源服务器,又懒得改原来的图片url,所以想通过squid来自动替换域名。

只要改一个语句,改掉原来的 cache_peer 后的地址到新服务器,并在name=img后面加上forceddomain=www.test2.com,如下:

cache_peer www.test2.com parent 80 0 no-query originserver name=test forceddomain=www.test2.com
官方说明(http://www.squid-cache.org/Doc/config/cache_peer/):

forceddomain=name
 Set the Host header of requests forwarded to this peer.
 Useful in accelerator setups where the server (peer)
 expects a certain domain name but clients may request
 others. ie example.com or www.example.com

4KB 扇区磁盘上的 Linux:实际建议

unpack() [function.unpack]: Type v: not enough input, need 2

PHPZip.class.php报unpack() [function.unpack]: Type v: not enough input, need 2, have 0 in解决办法

正常的在win环境下是没问题的,但是在linux环境下就会报unpack() [function.unpack]: Type v: not enough input, need 2, have 0 in错误,解决办法就是

在类文件中找到 if($bytes == 0x504b0506) 改成 if(substr(dechex($bytes),-8,8) == '504b0506')  就是这样。

 

--------------

$bytes=($bytes << 8) | ord($byte);
改为
$bytes=(($bytes << 40)>>32)| ord($byte);

php5 install FAQ

1.
Error: Configure: error: xml2-config not found. Please check your libxml2 installation.
Fix: yum install libxml2 libxml2-devel
# aptitude install libxml2-dev (For ubuntu)

2.
Error: configure: error: Cannot find OpenSSL’s
Fix: yum install openssl openssl-devel

3.
Error: Configure: error: Please reinstall the BZip2 distribution
Fix: yum install bzip2 bzip2-devel

 

4.
Error: Configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/
Fix: yum install curl curl-devel (For Redhat & Fedora)
# install libcurl4-gnutls-dev (For Ubuntu)

5.
Error: Configure: error: libjpeg.(also) not found.
Fix: yum -y install gd
yum -y install gd-devel
yum install libjpeg libjpeg-devel

6.
Error: Configure: error: libpng.(also) not found.
Fix: yum install libpng libpng-devel
#apt-get install libpng12-dev

7) Configure: error: freetype.h not found.
Solutions :
yum install freetype-devel

8) Configure: error: Unable to locate gmp.h

Solutions :
yum install gmp-devel

9) Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!

Solutions :
yum install mysql-devel (For Redhat & Fedora)

# apt-get install libmysql++-dev (For Ubuntu)

10) Configure: error: Please reinstall the ncurses distribution

Solutions :
yum install ncurses ncurses-devel

11) Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

Solutions :
yum install unixODBC-devel

12. --with-pspell=shared
Error: Configure: error: Cannot find pspell
Fix: yum install pspell-devel

13) --with-mcrypt=shared
Error: configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Fix: yum install libmcrypt-devel

# apt-get install libmcrypt-dev

14) Configure: error: snmp.h not found. Check your SNMP installation.

Solutions :

yum install net-snmp net-snmp-devel

15)开启LDAP服务还需要
yum -y install openldap-devel openldap-servers openldap-clients

16)configure: error: No curses/termcap library found
网上有的说法是:
–with-named-curses-libs=/usr/lib/libncursesw.so.5
其实是不对的,虽然能解决configure的错误,但是make的时候会提示错误,正确的做法应该是
yum -y install ncurses-devel (for redhat)
apt-get install libncurses5-dev(for debian)

17)configure: error: cannot find output from lex; giving up
yum -y install flex

18)configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
yum -y install zlib-devel openssl-devel
debian:apt-get install zlib1g-dev

19)configure: error: libXpm.(a|so) not found.
apt-get install libxpm-dev

20) configure: error: Could not find pcre.h in /usr
Fix: yum install pcre-devel

21) configure: error: Could not find libpcre.(a|so) in /usr
Fix: cp /usr/lib/libpcre.a /usr/libpcre.a
Refer: http://bugs.php.net/bug.php?id=1647

22. --with-db4
Error: configure: error: DBA: Could not find necessary header file(s).
Fix: yum install gdbm-devel db4-devel
Error: configure: error: Header contains different version
Fix: --with-libdir=lib (--libdir=/usr/lib64, which is wrong)
Refer: http://bugs.php.net/bug.php?id=40707

23) configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing
Fix: yum install libc-client-devel

24. --enable-intl=shared
Error: configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.

25.--with-ldap=shared
Error: configure: error: Cannot find ldap.h
Fix: yum install openldap-devel
Error: configure: error: Cannot find ldap libraries in /usr/lib64.

26.--with-readline=shared
Error: configure: error: Please reinstall readline - I cannot find readline.h
Fix: yum install readline-devel

27.--with-tidy=shared
Error: configure: error: Cannot find libtidy
Fix: yum install libtidy-devel

28.--with-xsl=shared
Error: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Fix: yum install libxslt-devel

CentOS x64 里php 源码编译出错参见情况及解决办法

yum install libxml2-devel.x86_64

configure: error: Cannot find OpenSSL’s

yum install openssl-devel.x86_64

configure: error: Could not find pcre.h in /usr/local

yum install pcre-devel.x86_64

configure: error: Could not find pcre.h in /usr/local

"--with-pcre-regex=/usr/include" \

configure: error: Could not find libpcre.(a|so) in /usr/include

"--with-pcre-regex=/usr" \

configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/

yum install curl-devel.x86_64

configure: error: libjpeg.(a|so) not found.

yum install libjpeg-devel.x86_64

configure: error: libpng.(a|so) not found.

yum install libpng-devel.x86_64

configure: error: freetype.h not found.

yum install freetype-devel.x86_64

configure: error: Please reinstall the iconv library.

"--with-iconv" \

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

yum install libmcrypt.x86_64 libmcrypt-devel.x86_64

configure: error: Please reinstall libmhash – I cannot find mhash.h

yum install mhash.x86_64 mhash-devel.x86_64

Note that the MySQL client library is not bundled anymore!

yum install php-mysql.x86_64 mysql-devel.x86_64

configure: error: Please reinstall the BZip2 distribution

yum install bzip2-devel.x86_64

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
DISABLE IMAP
configure: error: Cannot find pspell

yum install aspell-devel.x86_64

configure: error: Cannot find libtidy

yum install libtidy.x86_64 libtidy-devel.x86_64

error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

yum install libxslt.x86_64 libxslt-devel.x86_64

collect2: ld returned 1 exit status

yum install glibc-utils.x86_64 libtool-ltdl-devel.x86_64

Step by step to guide PHP Compile

Step 1: Update & Install Development Tools & Libraries

yum update yum group install "Development Tools" yum group install "Development Libraries"

yum安装apache+php+mysql等

1. 安装Apahce, PHP, Mysql, 以及php连接mysql库组件。
yum -y install httpd php mysql mysql-server php-mysql 

2. 配置开机启动服务
/sbin/chkconfig httpd on [设置apache服务器httpd服务开机启动]
/sbin/chkconfig --add mysqld [在服务清单中添加mysql服务]
/sbin/chkconfig mysqld on [设置mysql服务开机启动]

/sbin/service httpd start [启动httpd服务,与开机启动无关]
/sbin/service mysqld start [启动mysql服务,与开机无关]

3.设置 mysql数据库root帐号密码。
mysqladmin -u root password 'newpassword' [引号内填密码]

4. 让mysql数据库更安全
mysql -u root -p [此时会要求你输入刚刚设置的密码,输入后回车即可]

mysql> DROP DATABASE test; [删除test数据库]
mysql> DELETE FROM mysql.user WHERE user = ''; [删除匿名帐户]
mysql> FLUSH PRIVILEGES; [重载权限]

5. 按照以上的安装方式, 配置出来的默认站点目录为/var/www/html/新建一个php脚本:
phpinfo();
?>

6. 新建一个数据库,添加一个数据库用户,设置用户权限。写个php脚本测试一下数据库连接吧。
mysql> CREATE DATABASE my_db; 
mysql> GRANT ALL PRIVILEGES ON my_db.* TO 'user'@'localhost' IDENTIFIED BY 'password'; 



//安 装apache扩展
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
//安装php的扩展
yum install php-gd
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
// 安装mysql扩展
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

7, 如果命令行没有phpize,运行以下命令 
yum -y install php-devel

8,安装pdo
pecl install pdo
PHP_PDO_SHARED=1 pecl install pdo_mysql

 

pecl install PDO_SQLITE


9, 安装memcache
yum -y install php-pecl-memcache

10, 安装php-eaccelerator
yum install php-eaccelerator.i686



CentOS 5.x 系统下使用yum 升级php到5.2.x 最方便方法 
近期使用testlink 1.82 ,提及php需要升级到5.2以上,而centos 5.x目前提供php版本为5.1.6,
通过以下方法升级PHP到5.2比较方便,现推荐给大家。

先将以下地址导入。

# rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

# vi /etc/yum.repos.d/CentOS-Base.repo 增加下面信息

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

执行命令,自动升级。

yum update php -y
yum install libmcrypt -y

checking for re2c... no

checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.


http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download