The Evolution of PHP – Infographic

http://www.cabotsolutions.com/2016/06/the-evolution-of-php-infographic/

PHP was created by Rasmus Lerdorf in 1994 and was publicly released in June 1995. Back then, it was the abbreviated form of Personal Home Page tools. After two years, in 1997, it entered public domain as PHP/F1 2.0. A year later, two programmers, Zeev Suraski and Andi Gutmans, rewrote the base of the original version and launched PHP 3.

PHP 4, which came out in 2000, incorporated a scripting engine named Zend Engine that was designed by Suraski and Gutmans. Three more major versions with some sub-versions were launched in the later years with the latest version 7.0 released in 2015.

Two decades after its inception, PHP has registered a phenomenal growth and is still going strong. Today, it controls over 80% of all the websites on the globe. This includes majors like Facebook, Wikipedia and WordPress among others.

The Evolution of PHP – Infographic

Your software is Vitamin or Painkiller?

How to Quickly Tell If Your Software Product Idea Will Be Successful : http://www.phpclasses.org/blog/post/411-How-to-Quickly-Tell-If-Your-Software-Product-Idea-Will-Be-Successful.html

The dream of many software developers is to create their own business, so they can work for themselves all the time instead of working for others.

So they start thinking of ideas for new software products, but they are never certain of which ideas will be successful. So they often pick one idea they like and then start working it. After many months they launch it but often the product does not have the traction they hoped.

This is what is called the shot in the dark. The dream turns into a frustration. I have found myself in this situation many times, so I thought to myself that there should be a way to avoid the frustration.

I found the best description for PHP 7 upgrade

I did the upgrade by this article but the PHP did’nt work:

http://askubuntu.com/questions/705880/how-to-install-php-7

This works for me: 1. Re-Install PHP 5.6

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0

From php5.6 to php7.0 :

Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart

http://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04

********************************

PHP7: Mcrypt PHP extension required.

sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade

http://stackoverflow.com/questions/34083470/php7-laravel-mcrypt-issue

***********************************

php7 CURL PHP extension:

sudo apt-get install php7.0-curl

install GD:

sudo apt-get install php7.0-gd
************************************
max_file_uploads 2 -> 20M

sudo nano /etc/php/7.0/apache2/php.ini

I edited in nano.

sudo service apache2 restart

*************************************

PHP7 Install SQLITE

sudo apt-get install php7.0-sqlite3
sudo service apache2 restart

*************************************

php framework independent development

I am searching the solution. Some useful article.

Build your own PHP Framework with Symfony Components : http://www.sitepoint.com/build-php-framework-symfony-components/

Symfony2: How to create framework independent controllers? : http://php-and-symfony.matthiasnoback.nl/2014/06/how-to-create-framework-independent-controllers/

Symfony2: Framework independent controllers part 2: Don’t use annotations : http://php-and-symfony.matthiasnoback.nl/2014/06/don-t-use-annotations-in-your-controllers/

Symfony2: Framework independent controllers part 3: Loose ends : http://php-and-symfony.matthiasnoback.nl/2014/06/framework-independent-controllers-part-3/

Definitive Laravel 4 to Laravel 5 Migration Guide : http://slashnode.com/definitive-laravel-4-to-laravel-5-migration-guide/

Removes duplicates values from an multidimensional array (PHP)

The idea: Serialize the item of the item (array) of the multidimensional array

Than Sort out the same item.

// serialize — Generates a storable representation of a value
$workArr =array();
foreach ($newDateArr as $value) {
$workArr[]= serialize ( $value );
}

$workArr = array_unique($workArr);

//unserialize — Creates a PHP value from a stored representation
$workArr2 =array();
foreach ($workArr as $value) {
$workArr2[]= unserialize( $value );
}

other source – but this was not worked for me:

How to remove duplicate values from a multi-dimensional array in PHP

http://stackoverflow.com/questions/307674/how-to-remove-duplicate-values-from-a-multi-dimensional-array-in-php

PHP sessions default timeout

,

Q: would a user eventually be “logged out” after some time of inactivity?
A: It depends on the server configuration or the relevant directives (session.gc_maxlifetime) in php.ini. Typically the default is 24 minutes (1440 seconds), but your webhost may have altered the default to something else.

http://stackoverflow.com/questions/9904105/php-sessions-default-timeout

CakePHP – session timeout: http://stackoverflow.com/questions/20348038/cakephp-session-timeout

Preventing Memory Leaks in PHP

Image resizing need memory. I use this script to prevent memory leak.

I use Intervention Image library for resizing I often get ‘Allowed memory size of …. bytes exhausted (tried to allocate … bytes)’ message.

////////////////////////////////////////////////////
//get memory_limit info from php.ini
$memoryAvailable = filter_var(ini_get(“memory_limit”), FILTER_SANITIZE_NUMBER_INT) * 1048576;

//getting the image width and height
$imageInfo = getimagesize($destinationPath . ‘/’ . $filename);

//This is quite rough and includes a fudge factor, 2.5, which you may want to experiment with.
$requiredMemory = ( $imageInfo[0] * $imageInfo[1] * ($imageInfo[‘bits’] / 8) * $imageInfo[‘channels’] * 2.5 );

//check memory usage
if (memory_get_usage() + $requiredMemory < $memoryAvailable) {

//we have enough memory to resize the image.
}
////////////////////////////////////////////////////

Free PHP obfuscator, Encoding PHP

PHP: Code obfuscation in 10 steps: https://www.blubgoo.com/php-code-obfuscation-in-10-steps/

PhpMinify: http://www.binpress.com/app/phpminify/632

********************
Encoding & Decoding PHP Code: https://perishablepress.com/encoding-decoding-php/

Example: https://perishablepress.com/tools/decoding/

PHP Classes: http://www.phpclasses.org/package/4926-PHP-Obfuscate-PHP-as-base64-encoded-strings.html

GitHub: PHP Obfuscator

Ncryptd, open-source: http://ncryptd.com/

PHP Obfuscator

https://github.com/naneau/php-obfuscator

This is an “obfuscator” for PSR/OOp PHP code. Different from other obfuscators, which often use a (reversible) eval() based obfuscation, this tool actually parses PHP, and obfuscates variable names, methods, etc. This means is can not be reversed by tools such as UnPHP. This library was written out of the need to obfuscate the source for a private library which for various reasons could not be shared without steps to protect the source from prying eyes. It is not technically feasible to “encrypt” PHP source code, while retaining the option to run it on a standard PHP runtime.

install: git clone https://github.com/naneau/php-obfuscator , composer install

Run: path//php-obfuscator$ ./bin/obfuscate obfuscate input output

input, output – directories in the php-obfuscator folder.

 

PHP Design Patterns

This is a collection of known design patterns and some sample code how to implement them in PHP. Every pattern has a small list of examples (most of them from Zend Framework, Symfony2 or Doctrine2 as I’m most familiar with this software).

https://github.com/domnikl/DesignPatternsPHP

Egy nagyon hasznos, példákkal teletűzdelt összefoglaló a PHP-ban használatos (divatos) programozási mintákról .

Creational

AbstractFactory
Builder
FactoryMethod
Multiton (is considered an anti-pattern! )
Pool
Prototype
SimpleFactory
Singleton  (is considered an anti-pattern! )
StaticFactory

Structural

Adapter
Bridge
Composite
DataMapper
Decorator
DependencyInjection
Facade
FluentInterface
Proxy
Registry

Behavioral

ChainOfResponsibilities
Command
Iterator
Mediator
Memento
NullObject
Observer
Specification
State
Strategy
TemplateMethod
Visitor

More

Delegation
ServiceLocator
Repository