Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Wednesday, March 9, 2011

a temporary solution for PEAR Install with PHP5.3

I met a Bug of PHP(still doesn't fixed yet) about halt_compiler function which caused installing PEAR fail.

php go-pear.phar


This command doesn't work in PHP5.3

To fix(for the time being) it, use this command:

php -ddetect_unicode=0 go-pear.phar

Tuesday, March 2, 2010

The most easy way to install geoip php extension note

在网上找了一堆安装geo ip模块的方法,各种方法都很麻烦。现在本尊(无量牛逼最三三尊)来整理一个最简单的安装方法如下。

1.install GEOIP C Library
http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz
./configure
make
sudo make install

2.Install GEOIP PHP Extension
sudo pecl install geoip

3.Following message from step2, for example:
Build process completed successfully
Installing '/usr/local/lib/php/20060613/geoip.so'
install ok: channel://pecl.php.net/geoip-1.0.7
configuration option "php_ini" is not set to php.ini location
You should add "extension=geoip.so" to php.ini

4.Install GeoIP database
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip -d GeoIP.dat.gz
sudo cp GeoIP.dat /usr/local/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
sudo cp GeoLiteCity.dat /usr/local/share/GeoIP/GeoLiteCity.dat
sudo mv /usr/local/share/GeoIP/GeoLiteCity.dat /usr/local/share/GeoIP/GeoIPCity.dat

5.test
<?php print_r(geoip_record_by_name('125.63.166.38'));

Friday, June 5, 2009

遇到表单POST数据结构正常,但内容为空的问题。

当你遇到这样的问题,请注意你的一个PHP扩展是不是被关掉了:
extension=filter.so


打开它就好了。

Thursday, June 4, 2009

Nginx upload module的upload_pass_form_field设置pass所有的表单字段

虽然参数是regexp,但请注意要这样使用:
upload_pass_form_field "^.*$";


如果只是这样的话,会丢失Array的字段。
upload_pass_form_field ".*";

Saturday, May 30, 2009

Nginx upload module does not support input array for PHP

Please refer below email,

Jacky Zhang wrote:
> Hi Valery,
>
> It's fine if I using nginx upload module to upload a signle file.
> but It look incorrect that when I use a input like this:
>
>
<input type="file" name="userfiles[]" />

>
> Do you have any suggestion?

No, arrays won't work, you have to list every file input field individually.

--
Best regards,
Valery Kholodkov

Tuesday, April 21, 2009

Zend Studio specify a variable to a class for hint

a example is:

/* @var $m Memcache */
$m = memcache_connect();

Saturday, January 24, 2009

a simple way to get your PHP script if running in CLI

There is a function to get that way easier.

public static function inCli() {
return php_sapi_name() == ‘cli’;
}

Zend Studio远程调试PHP再整理

1.下载Debug:
http://downloads.zend.com/pdt/server-debugger/

2.将压缩包中的5_2_x_comp中的ZendDebugger.dll解压到新建目录:
C:\Program Files\Zend\ZendDebugger-5.2.14\php-5.2.x

3.安装Zend Optimize或下载Zend Extension Manager.dll

4.修改php.ini(新增)(根据自己的情况对路径做修改)
zend_extension_ts="C:\Program Files\Zend\ZendExtensionManager.dll"
zend_extension_manager.debug_server_ts="C:\Program Files\Zend\ZendDebugger-5.2.14"
zend_debugger.expose_remotely=allowed_hosts
zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/16
zend_debugger.allow_tunnel=127.0.0.1/32

5.解压debug压缩包里的dummy.php到要调试的网站根目录。

6.重启Web server.

———————–热情分割线———————–

另外,配置也可参考这个不用ZO的:
zend_extension_ts=”D:/Servers/php5/ext/ZendDebugger.dll”
zend_debugger.allow_hosts=192.168.1.1
zend_debugger.expose_remotely=always