PHP: How i enable PHP version 7.4 and disable PHP version 7.3

 In this PHP Tutorial, I will let you know how to install PHP version from 7.3 to 7.4 using command on your linux machine.

There are some cases in which you have to upgrade your PHP version but before upgrading to any version from previous one, you should be always aware from its incompatibilities.

There is very simple step that you need to follow to update your PHP version to newest.

First, You need to add the PPA ondrej/php which will provide the PHP 7.4 package and other required PHP extensions







After successfully adding the PPA, you can install any version of PHP 7.

sudo apt install php7.4


Now you can run following command to install commanly used php-extensions:

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y


If you are using PostgreSQL for database connection then you need to install below extension :

sudo apt-get install php7.4-pgsql

If you have already installed any other version of PHP then you should disable that version first and then enable the current version of PHP that you want to use for your application by running following command:


sudo a2dismod php7.3

sudo a2enmod php7.4


Now restart your apache server by running below command:


sudo service apache2 restart

You are done with the steps and now you can check the PHP version by running following command:

php -v





Storing Session Data with Drupal 8

 The Drupal session management subsystem is built on top of the Symfony session component. It is optimized in order to minimize the impact of anonymous sessions on caching proxies. A session is only started if necessary and the session cookie is removed from the browser as soon as the session has no data. For this reason it is important for contributed and custom code to remove session data if it is not used anymore.



Session data is accessed via the \Symfony\Component\HttpFoundation\Request::getSession() method, which returns an instance of \Symfony\Component\HttpFoundation\Session\SessionInterface. The most important methods on SessionInterface are set(), get(), and remove().


The following code fragment shows the implementation of a counter controller relying on the session:



public function counter(Request $request) {

  $session = $request->getSession();

  $count = $session->get('mymodule.counter', 0) + 1;

  $session->set('mymodule.counter', $count);


  return [

    '#markup' => $this->t('Page Views: @count', ['@count' => $count]),

    '#cache' => [

      'max-age' => 0,

    ],

  ];

}


public function reset(Request $request) {

  $session = $request->getSession();

  $session->remove('mymodule.counter');

}

It is important to keep the amount of data stored inside the session to a minimum, as the complete session is loaded on every request. Also third party session storage backends do not necessarily allow objects of unlimited size. If it is necessary to collect a non-trivial amount of data specific to a user's session, use the Key/Value store to save the serialized data and only store the key to the entry in the session.


In Drupal 8, there is a need to store information associated with a user's session. There are two services for temporarily storing user-specific and non-user-specific data in key/value format, namely, use user.private_tempstore and user.shared_tempstore.

TempStore

A tempstore is for data that needs to be persisted between requests without being saved back to the canonical storage (such as an entity or configuration object)

Two methods can be effectively used for  private_tempstore - Use "\Drupal::service()" and Dependency Injection.

Use "\Drupal::service()"

To set Temporary Data

$tempstore = \Drupal::service('user.private_tempstore')->get('mymodule_name');

$tempstore->set('my_variable_name', $some_data);

To read Temporary Data

$tempstore = \Drupal::service('user.private_tempstore')->get('mymodule_name'); 

$tempstore->get('my_variable_name', $some_data);

PrivateTempStore

A PrivateTempStore can be used to make temporary, non-cache data available across requests. The data for the PrivateTempStore is stored in one key/value collection. PrivateTempStore data expires automatically after a given timeframe.

Dependency Injection

To use this service need to invoke the following “use” statement

use Drupal\user\PrivateTempStoreFactory;           

use Symfony\Component\DependencyInjection\ContainerInterface;

Temporary store - that is private to the current user



What is Drupal | Drupal History |

Explain what is Drupal?

Drupal is free, open-source content management framework written in PHP. Drupal is distributed under GNU General Public License.

Drupal is a framework which organize, manage and publish content easily and provides a lot of features of customization.

As of December 2019, the Drupal community comprised more than 1.39 million    members,  including 117,000 users actively contributing, resulting in more than 44,000 free modules that extend and customize Drupal functionality, over 2,800 free themes that change the look and feel of Drupal, and at least 1,300 free distributions that allow users to quickly and easily set up a complex, use-specific Drupal in fewer steps.

The standard release of Drupal, known as Drupal core, contains basic features common to content-management systems. These include user account registration and maintenance, menu management, RSS feeds, taxonomy, page layout customization, and system administration. The Drupal core installation can serve as a simple website, a single- or multi-user blog, an Internet forum, or a community website providing for user-generated content.

Drupal originally written by Dries Buytaert as a message board, Drupal became an open source project in 2001. he name Drupal represents an English rendering of the Dutch word druppel, which means "drop" (as in a water droplet).  The name came from the now-defunct Drop.org website, whose code slowly evolved into Drupal. Buytaert wanted to call the site "dorp" (Dutch for "village") for its community aspects, but mistyped it when checking the domain name and thought the error sounded better.

As of 2014 Drupal is developed by a community. From July 2007 to June 2008 the Drupal.org site provided more than 1.4 million downloads of Drupal software, an increase of approximately 125% from the previous year.

As of January 2017 more than 1,180,000 sites use Drupal. These include hundreds of well-known organizations, including corporations, media and publishing companies, governments, non-profits, schools, and individuals. Drupal has won several Packt Open Source CMS Awards and won the Webware 100[clarification needed] three times in a row.

Drupal 6 was released on February 13, 2008, on March 5, 2009 Buytaert announced a code freeze for Drupal 7 for September 1, 2009. Drupal 7 was released on January 5, 2011, with release parties in several countries. After that, maintenance on Drupal 5 stopped, with only Drupal 7 and Drupal 6 maintained. Drupal 7 series maintenance updates are released regularly. Previously, Drupal 7's end-of-life was scheduled for November 2021, but given the impact of COVID-19, the end of life has been pushed back until November 28, 2022. Drupal 8 will still be end-of-life on November 2, 2021.

On October 7, 2015 Drupal 8 first release candidate (rc1) was announced. Drupal 8 includes new features and improvements for both users and developers, including: a revamped user interface; WYSIWYG and in-place editing; improved mobile support; added and improved key contributed modules including Views, Date, and Entity Reference; introduced a new object-oriented backend leveraging Symfony components; revamped configuration management; and improved multilingual support. Drupal 8 rc1 is the collective work of over 3,200 core contributors.

Drupal 8.0.0 was released on November 19, 2015. Subsequent major and minor releases which bring numerous improvements and bug fixes (including CKEditor WYSIWYG enhancements, added APIs, an improved help page) can be found on the Releases page.

Drupal 9 initial release 9.0.0 was on June 3, 2020.

Drupal 10's initial release schedule is on July 2022.

Core

In the Drupal community, "core" refers to the collaboratively built codebase that can be extended through contributory modules and – for versions prior to Drupal 8 – is kept outside of the "sites" folder of a Drupal installation. (Starting with version 8, core is kept in its own 'core' sub-directory.) Drupal core is the stock element of Drupal. Common Drupal-specific libraries, as well as the bootstrap process, are defined as Drupal core; all other functionality is defined as Drupal modules including the system module itself.

In a Drupal website's default configuration, authors can contribute content as either registered or anonymous users (at the discretion of the administrator). This content is accessible to web visitors through a variety of selectable criteria. As of Drupal 8, Drupal has adopted some Symfony libraries into Drupal core.

Core modules also includes a hierarchical taxonomy system, which lets developers categorize content or tagged with key words for easier access.

Drupal maintains a detailed changelog of core feature updates by version.





National Symbols | राष्ट्रीय चिह्न

 राष्ट्रीय चिह्न एक प्रतीक है जिसे किसी राष्ट्र या बहु-राष्ट्रीय राज्य द्वारा अपने प्रतीक के रूप में उपयोग के लिए आरक्षित किया जाता है। इस चिह्न का प्रयोग सरकारी कागजों- दस्तावेजों, अभिलेखों, प्रपत्रों, मुद्रा आदि पर किया जाता है।

इस खण्ड में आपको भारत की राष्ट्रीय पहचान के प्रतीकों का परिचय दिया गया है। यह प्रतीक भारतीय पहचान और विरासत का मूलभूत हिस्सा हैं। विश्व भर में बसे विविध पृष्ठभूमियों के भारतीय इन राष्ट्रीय प्रतीकों पर गर्व करते हैं क्योंकि वे प्रत्येक भारतीय के हृदय में गौरव और देश भक्ति की भावना का संचार करते हैं।

राष्ट्रीय ध्वज






राष्ट्रीय ध्वज तिरंगे में समान अनुपात में तीन क्षैतिज पट्टियां हैं: केसरिया रंग सबसे ऊपर, सफेद बीच में और हरा रंग सबसे नीचे है। ध्वज की लंबाई-चौड़ाई का अनुपात 3:2 है। सफेद पट्टी के बीच में नीले रंग का चक्र है।

शीर्ष में केसरिया रंग देश की ताकत और साहस को दर्शाता है। बीच में स्थित सफेद पट्टी धर्म चक्र के साथ शांति और सत्य का संकेत है। हरा रंग देश के शुभ, विकास और उर्वरता को दर्शाता है।

इसका प्रारूप सारनाथ में अशोक के सिंह स्तंभ पर बने चक्र से लिया गया है। इसका व्यास सफेद पट्टी की चौड़ाई के लगभग बराबर है और इसमें 24 तीलियां हैं। भारत की संविधान सभा ने राष्ट्रीय ध्वज का प्रारूप 22 जुलाई 1947 को अपनाया।

राष्ट्र–गान

भारत का राष्ट्रगान 'जन गण मन' है, जो मूलतः बांग्ला भाषा में गुरुदेव रवीन्द्रनाथ ठाकुर द्वारा लिखा गया था, जिसे भारत सरकार द्वारा 24 जनवरी 1950 को राष्ट्रगान के रूप में अंगीकृत किया गया। इसके गायन की अवधि लगभग 52 सेकेण्ड निर्धारित है। गुरुदेव रवीन्द्रनाथ ठाकुर विश्व के एकमात्र व्यक्ति हैं, जिनकी रचना को एक से अधिक देशों में राष्ट्रगान का दर्जा प्राप्त है। उनकी एक दूसरी कविता 'आमार सोनार बाँग्ला' को आज भी बांग्लादेश में राष्ट्रगान का दर्जा प्राप्त है।


जन-गण-मन अधिनायक जय हे

भारत भाग्‍य विधाता ।

पंजाब-सिंधु-गुजरात-मराठा

द्राविड़-उत्‍कल-बंग

विंध्य हिमाचल यमुना गंगा

उच्‍छल जलधि तरंग

तव शुभ नामे जागे, तव शुभ आशिष मांगे

गाहे तव जय-गाथा ।

जन-गण-मंगलदायक जय हे भारत भाग्‍य विधाता ।

जय हे, जय हे, जय हे, जय जय जय जय हे ।

राष्ट्रीय गीत

वन्‍दे मातरम गीत बंकिम चन्‍द्र चटर्जी द्वारा संस्‍कृत में रचा गया है; यह स्‍वतंत्रता की लड़ाई में लोगों के लिए प्ररेणा का स्रोत था। इसका स्‍थान जन गण मन के बराबर है। इसे पहली बार 1896 में भारतीय राष्‍ट्रीय कांग्रेस के सत्र में गाया गया था। 


वंदे मातरम्, वंदे मातरम्!

सुजलाम्, सुफलाम्, मलयज शीतलाम्,

शस्यश्यामलाम्, मातरम्!

वंदे मातरम्!

शुभ्रज्योत्सनाम् पुलकितयामिनीम्,

फुल्लकुसुमित द्रुमदल शोभिनीम्,

सुहासिनीम् सुमधुर भाषिणीम्,

सुखदाम् वरदाम्, मातरम्!

वंदे मातरम्, वंदे मातरम्॥

-----------------------------------

राजकीय प्रतीक







भारत का राजचिह्न सारनाथ स्थित अशोक के सिंह स्तंभ की अनुकृति है, जो सारनाथ के संग्रहालय में सुरक्षित है। मूल स्तंभ में शीर्ष पर चार सिंह हैं, जो एक-दूसरे की ओर पीठ किए हुए हैं। इसके नीचे घंटे के आकार के पदम के ऊपर एक चित्र वल्लरी में एक हाथी, चौकड़ी भरता हुआ एक घोड़ा, एक सांड तथा एक सिंह की उभरी हुई मूर्तियां हैं, इसके बीच-बीच में चक्र बने हुए हैं। एक ही पत्थर को काट कर बनाए गए इस सिंह स्तंभ के ऊपर 'धर्मचक्र' रखा हुआ है।
भारत सरकार ने यह चिन्ह 26 जनवरी, 1950 को अपनाया। इसमें केवल तीन सिंह दिखाई पड़ते हैं, चौथा दिखाई नही देता। पट्टी के मध्य में उभरी हुई नक्काशी में चक्र है, जिसके दाईं ओर एक सांड और बाईं ओर एक घोड़ा है। दाएं तथा बाएं छोरों पर अन्य चक्रों के किनारे हैं। आधार का पदम छोड़ दिया गया है। फलक के नीचे मुण्डकोपनिषद का सूत्र 'सत्यमेव जयते' देवनागरी लिपि में अंकित है, जिसका अर्थ है- 'सत्य की ही विजय हो


राष्ट्रीय पक्षी





भारतीय मोर, पावों क्रिस्‍तातुस, भारत का राष्‍ट्रीय पक्षी एक रंगीन, हंस के आकार का पक्षी पंखे आकृति की पंखों की कलगी, आँख के नीचे सफेद धब्‍बा और लंबी पतली गर्दन। इस प्रजाति का नर मादा से अधिक रंगीन होता है जिसका चमकीला नीला सीना और गर्दन होती है और अति मनमोहक कांस्‍य हरा 200 लम्‍बे पंखों का गुच्‍छा होता है। मादा भूरे रंग की होती है, नर से थोड़ा छोटा और इसमें पंखों का गुच्‍छा नहीं होता है। नर का दरबारी नाच पंखों को घुमाना और पंखों को संवारना सुंदर दृश्‍य होता है।

राष्‍ट्रीय पशु





राजसी बाघ, तेंदुआ टाइग्रिस धारीदार जानवर है। इसकी मोटी पीली लोमचर्म का कोट होता है जिस पर गहरी धारीदार पट्टियां होती हैं। लावण्‍यता, ताकत, फुर्तीलापन और अपार शक्ति के कारण बाघ को भारत के राष्‍ट्रीय जानवर के रूप में गौरवान्वित किया है। ज्ञात आठ किस्‍मों की प्रजाति में से शाही बंगाल टाइगर (बाघ) उत्‍तर पूर्वी क्षेत्रों को छोड़कर देश भर में पाया जाता है और पड़ोसी देशों में भी पाया जाता है, जैसे नेपाल, भूटान और बांग्‍लादेश। भारत में बाघों की घटती जनसंख्‍या की जांच करने के लिए अप्रैल 1973 में प्रोजेक्‍ट टाइगर (बाघ परियोजना) शुरू की गई। अब तक इस परियोजना के अधीन 27 बाघ के आरक्षित क्षेत्रों की स्‍थापना की गई है जिनमें 37, 761 वर्ग कि.मी. क्षेत्र शामिल है।

राष्ट्रीय पुष्प








कमल (निलम्‍बो नूसीपेरा गेर्टन) भारत का राष्‍ट्रीय फूल है। यह पवित्र पुष्‍प है और इसका प्राचीन भारत की कला और गाथाओं में विशेष स्‍थान है और यह अति प्राचीन काल से भारतीय संस्‍कृति का मांगलिक प्रतीक रहा है।

भारत पेड़ पौधों से भरा है। वर्तमान में उपलब्‍ध डाटा वनस्‍पति विविधता में इसका विश्‍व में दसवां और एशिया में चौथा स्‍थान है। अब तक 70 प्रतिशत भौगोलिक क्षेत्रों का सर्वेक्षण किया गया उसमें से भारत के वनस्‍पति सर्वेक्षण द्वारा 47,000 वनस्‍पति की प्रजातियों का वर्णन किया गया है।




Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...