How to install PHP 5.3.X as secondary php version from source
PHPV=5.3.6
cd /usr/local/src
wget http://us.php.net/get/php-$PHPV.tar.gz/from/this/mirror
mv mirror php-$PHPV.tar.gz
tar xzvf php-$PHPV.tar.gz
chown -R $USER:$USER php-$PHPV/
cd php-$PHPV/
apt-get install libxml2-dev libssl-dev libcurl4-gnutls-dev libjpeg62-dev libpng12-dev libfreetype6-dev unixodbc-dev
./configure --prefix=/usr/local/php5.3 --with-config-file-path=/usr/local/etc/php5.3 --with-config-file-scan-dir=/usr/local/etc/php5.3/$SAPIconf.d --with-libdir=/lib --disable-cgi --with-libxml-dir=/usr/ --with-mysql=/usr/ --enable-pdo --with-pdo-mysql --with-mysqli --with-zlib-dir=/usr --with-curl --with-gd --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib --with-gettext --enable-mbstring --enable-soap --enable-ftp --enable-fpm --with-openssl
make
make test
make install
More help in case you have errors: PHP-Configure-und-Compile-Fehler
<?php public static function getType($value, $max_length = 50){ $type = gettype($value); if($type == 'NULL' || $type == 'boolean' || $type == 'integer' || $type == 'double' || $type == 'object' || $type == 'resource' || $type == 'array' ) return array('type'=>$type,'value'=>$value); if($type == 'string' && empty($value)) return array('type'=>'NULL','value'=>$value); if($type == 'string' && strlen($value) > $max_length) return array('type'=>'blob','value'=>$value); if($type == 'string' && substr($value, 0,1) === '0') return array('type'=>'string','value'=>$value); if($type == 'string' && is_numeric($value)){ $int = (int) $value; $float = (float) $value; if($int == $value){ $value = $int; $type = 'integer'; }elseif($float == $value){ $value = $float; $type = 'double'; } }elseif($type == 'string'){ $type = 'string'; }else{ $type = 'blob'; } return array('type'=>$type,'value'=>$value); } ?
There is no num_row() function for PHP PDO
Here are my two solutions:
One with prepare & execute:
db->prepare($sql); $sth->execute(array($key)); $rows = $sth->fetch(PDO::FETCH_NUM); echo $rows[0]; One with query:
db->query($sql); $row = $result->fetch(PDO::FETCH_NUM); echo $row[0];
This class is used to load functions and array’s. It also can copy functions and array’s to the linux memory drive and load them from there to speed thinks up.
<?php if(!defined('DROOT')) trigger_error("Please define data location (DROOT)"); /** * * This class loads stuff * * 1) Functions * 2) Array's * * @todo Load array's * @category Data * @package TaMeR * @copyright Copyright (c) 2010 - 2011 Dennis T Kaplan * @license http://www.
It’s really annoying having to thing of html stuff like pre & br everytime you need to display something.
And it’s even worst if you like me test your code in cli and cgi.
So I wrote this little method to take care of it all. It’s nothing complicated but sure useful.
It detects cgi and cli, and formats everything accordingly.
<?php /** * e() --- Prints human-readable information about a variable * * string e ( mixed $expression[, string $name [, bool $return = false ]] ) * * Replacement for php echo, print, print_r(), var_export() etc */ /** * @category TaMeR * @copyright Copyright (c) 2008 - 2011 Dennis T Kaplan * @license http://www.
This is a php cli script that will create a database model from the database provided
Download via git from github -> phpcli
php zend/model.php -h This is a command line PHP script. Set table Options: -path=[ ] -table=[ ] Usage: php zend/model.php -arg=value Database Structure:
CREATE TABLE users ( Alias TEXT UNIQUE, Password TEXT, eMail TEXT, Avatar TEXT, Timezone TEXT, IP TEXT, count INTEGER, cookie TEXT, vars TEXT, status INTEGER DEFAULT 1, added date, updated datetime, PRIMARY KEY(Alias) ); Sample Output:
I just discovered that the goto statement is available since php 5.3
I love the guys from php for that.
I am a hobby programmer and unlike the professionals, I learned OOP via php, which is great but having goto available like back in the Amiga days made my day.
Tamer_ACL is a simple Zend Framework ACL plugin that uses the sqlite backend to store all the data.
How To Inatall Make sure you have a table called role in your authentication table and a table called alias you may change that to username if you like. The sql code is below.
Below are the files.
Before each file you will find installation instructions that should work even for the most novice Linux / Zend Framework developer.