Fatal error: Allowed memory size of 8388608 bytes exhausted

On January 2, 2012, in CakePHP, Concentrate, LAMP, Learning, PHP, Tips, by Sandeep Verma

Hits: 224  PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y) in file.php 1. memory_limit globally from php.ini memory_limit = 64M 2. memory_limit using .htaccess php_value memory_limit 64M 3. memory_limit inside a php script. ini_set(‘memory_limit’, ’64M’); To change the memory limit for one specific script by including a line such as [...]

Recursive Function for Nested Categories

On November 7, 2011, in CakePHP, Concentrate, Imagine, LAMP, Launch, Learning, Observe, by Sandeep Verma

Hits: 294  Nested Categories over Drop Down Categories and its sub categories are always useful while developing simple to huge applications. Here is a simple php code to create multi-leveled nested categories on select box to those categories. CREATE TABLE `tb_category` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pid` int(11) NOT NULL, `name` varchar(255) NOT NULL PRIMARY [...]

json_add for php

On January 5, 2011, in CakePHP, Concentrate, Imagine, Javascript, LAMP, Launch, Observe, Open Source, PHP, Tips, by Sandeep Verma

Hits: 444  JSON (JavaScript Object Notation) is a lightweight data-interchange format. 1. Easy for humans to read and write. 2. Easy for machines to parse and generate. 3. Collection of name/value pairs. 4. Used for C, C++, C#, Java, JavaScript, Perl, Python, and many others. 5. Compatible with universal data structures – array, vector, list, or [...]

Override PHP Function

On November 23, 2010, in CakePHP, LAMP, Open Source, PEAR, PHP, Tips, Tricks, by Sandeep Verma

Hits: 167  PHP have PECL (PHP Extension & Community Library) function to override built-in functions by replacing them in the symbol table. bool override_function ( string $function_name , string $function_args , string $function_code ) <?php override_function(‘strlen’, ‘$string’, ‘return override_strlen($string);’); function override_strlen($string){ return strlen($string); } ?> The above function “override_function()” require APD i.e. Advanced PHP Debugger. We [...]

PHP ORM – Create select box with mysql set or enum

On September 5, 2010, in CakePHP, LAMP, Mysql, Open Source, PHP, Tips, Web Application, by Sandeep Verma

Hits: 830  PHP have rich set of functions to solve real time problems in programming and web development.. thanks to Rasmus Lerdorf eval — Evaluate a string as PHP code A SET datatype can hold any number of strings from a predefined list of strings. The ENUM datatype restricts to a single member of the set [...]

CakePHP vs YII

On August 8, 2010, in CakePHP, LAMP, Open Source, PHP, Tips, Tricks, Web Application, by Sandeep Verma

Hits: 977  Have you checked my previous article on CakePHP… http://blog.svnlabs.com/2009/11/cakephp-in-svnlabs/ Yii (Yes, it is) — a high-performance component-based PHP framework best for developing large-scale Web applications. Yii have features, including MVC, DAO/ActiveRecord, I18N/L10N, caching, jQuery-based AJAX support, authentication and role-based access control, scaffolding, input validation, widgets, events, theming, Web services, and so on. Written in [...]

Framework vs CMS

On June 19, 2010, in CakePHP, Joomla, LAMP, PHP, Tips, Tricks, by Sandeep Verma

Hits: 106  Framework: A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. 1. CodeIgniter 2. CakePHP 3. Zend 4. Symfony CMS: A content management system (CMS) is the collection of procedures used to manage work flow in a collaborative environment. These procedures [...]

Tagged with:  

Create ZIP archives with PHP script and PEAR class

On April 16, 2010, in CakePHP, Fedora, LAMP, Linux, Open Source, PEAR, PHP, Tips, Tricks, by Sandeep Verma

Hits: 224  We can use PEAR to process zip files in PHP using Archive_Zip…. First set PEAR path in php include path using set_include_path Make Zipped file <?php include (‘Archive/Zip.php’);        // include PEAR ZIP package $obj = new Archive_Zip(‘test.zip’);  // zipped file name $files = array(‘svnlabs/1.gif’, ‘svnlabs/resume.doc’, ‘svnlabs/invoice.xls’);   // files add to zip if ($obj->create($files)) { [...]

PHP – File Upload Stream

On March 17, 2010, in CakePHP, Fedora, LAMP, Linux, PEAR, PHP, Tips, Tricks, Web Application, by Sandeep Verma

Hits: 381  PHP supports upload file stream… we can stream data to server using PHP stream_open() & stream_write() functions. There is alternate method in PEAR to transfer files to server1 to server2. PEAR have HTTP package for uploading files. HTTP_Request supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc. <?php require_once ”HTTP/Request.php”; $req =& new HTTP_Request(“http://domain.com/upload”); $req->setBasicAuth(“login”, ”pass”); $req->setMethod(HTTP_REQUEST_METHOD_POST); [...]

Magic of PEAR – Date TimeZone

On March 3, 2010, in CakePHP, LAMP, Open Source, Oscommerce, PEAR, PHP, Tips, Tricks, Web Services, by Sandeep Verma

Hits: 686  PEAR is a framework and distribution system for reusable PHP components. How we get PEAR packages with php files? Add block of code to the php file…. <?php // include PEAR class include (“Date.php”); // initialize Date object $d = new Date(“1981-08-07 01:30:11″); // retrieve date to display echo $d->getDate(); // retrieve date as [...]

Install the Alternative PHP Cache (APC)

On February 24, 2010, in CakePHP, CentOS, Fedora, LAMP, Linux, Open Source, PHP, Tips, by Sandeep Verma

Hits: 122  The Alternative PHP Cache (APC) is a free, open, and robust framework for caching and optimizing PHP intermediate code. yum install php-pear yum install php-devel httpd-devel yum groupinstall ‘Development Tools’ yum groupinstall ‘Development Libraries’ pecl install apc http://si2.php.net/manual/en/install.pecl.php

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...