August 24, 2006

[shell] find command

Filed under: Programming — HanaDaddy @ 11:50 pm

Check $path folder for the files that are older that 7 days and delete them.

 find $path 2>>$DLOG -mtime +7 ! -exec rm -rf {} \;

check man page

[php] PHP uploading problem

Filed under: Programming — HanaDaddy @ 11:40 pm

When you have problem with uploading large file to your PHP application, try to change below options in /etc/php.ini


;php.ini
max_execution_time = 0 ; unlimited
max_input_time = 0
memory_limit = 8M

;Maximum size of POST data that PHP will accept.
post_max_size = 240M ; Set this value to max upload file size that you want

file_uploads = On

; Maximum allowed size for uploaded files.
upload_max_filesize = 240M ; Set this value to max upload file size that you want

Also, if you use Apache 2.0 (Redhat) check if httpd.conf or /etc/httpd/cond.d/php.conf contains below option


LimitRequestBody 0 ; unit is bytes and 0 means unlimited.

[php] module compilation:Payflow Pro Verisign

Filed under: Programming — HanaDaddy @ 11:36 pm

I have my php already compiled and working perfectly, but I found that pfpro module was not compiled in.

I needed pfpro module, but I didn’t want to mess up with whole php recompilation…

First download linux SDK kit from verisign website. You need to create an account with verisign first.

Unzip/untar into /var/www/pfpro

So I decided with creating self-contained pfpro module.

1. make a directory and cd into it.
$mkdir mydir
$cd mydir

2. copy all files from php_source_dir/ext/pfpro to the new dir

$cp -rp /usr/src/redhat/SOURCES/php-x.x.x/ext/pfpro/* .

3. if you are using redhat, you need to install php-devel rpm package
Run

$phpize

4. Run
(php-config resides /usr/bin with redhat RPM, so you don't
need --with-php-config. /usr/bin is already in ENV)

$./configure --with-pfpro=shared,/var/www/pfpro/lib \
[--with-php-config=/path/to/php-config]

5. $make

6. $cp ./modules/pfpro.so /usr/lib/php4

7. insert below line into /etc/php.ini

extension=pfpro.so

8. restart httpd server

9. check with phpinfo()

NOTE: When you actaully code the php, you need to set environment variable n the php file before connecting to verisign. Of course you must provide the correct path.
putenv(”PFPRO_CERT_PATH=/var/www/pfpro/certs”);

[php] Installing addtional modules separately

Filed under: Programming — HanaDaddy @ 11:33 pm

Please refer to README.SELF-CONTAINED-EXTENSIONS from the original source distribution

—-from the readme file—-

Just to show you how easy it is to create a self-contained
extension, we will convert an embedded extension into a
self-contained one. Install PHP and execute the following
commands.

$ mkdir /tmp/newext
$ cd /tmp/newext

You now have an empty directory. We will copy the files from
the mysql extension:

$ cp -rp php-4.0.X/ext/mysql/* .

It is time to finish the module. Run:

$ phpize

You can now ship the contents of the directory - the extension
can live completely on its own.

The user instructions boil down to

$ ./configure \
[--with-php-config=/path/to/php-config] \
[--with-mysql=MYSQL-DIR]
$ make install

The MySQL module will either use the embedded MySQL client
library or the MySQL installation in MYSQL-DIR.

[php] Good things to know about global variable in PHP

Filed under: Programming — HanaDaddy @ 11:32 pm

From 4.1.0 (or 4.2.0)

Default register_globals in php.ini is off
This disables automatic forms input name to PHP vars function
(Eg.<input name=simpletext > => in php the input value is available as $simpletext with register_globals on )
Therefore, you need to access below Globals to access them

Also, short_open_tags is off
This disables <? ?> php tag. so you need to use <?php ?>.
(more…)

Page 2 of 3«123»
 

42 queries. 0.386 seconds. Powered by WordPress