PHP http://drupal8.ovh/en/tags/php en Avoid Spam form submissions - (Easy way of form Anti-Spam) http://drupal8.ovh/en/tutoriels/296/avoid-spam-form-submissions-easy-way-of-form-anti-spam <span class="field field--name-title field--type-string field--label-hidden">Avoid Spam form submissions - (Easy way of form Anti-Spam)</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to avoid spam contact form or other form submissions by robots (spam-bots) ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 03/16/2017 - 10:14</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><strong>Method 1. (Classical way)</strong></p> <p>Use a captcha system like Math captcha, Image captcha, reCaptcha of google....</p> <h2>Method 2. Use Honeypot</h2> <p>Honeypot use a very simple method to limit unwanted form submission by robots (any way, some robots can pass through this method). This method can block up to 98% of spam form submissions.</p> <h3>Concept of Honeypot.</h3> <p>By adding an invisible field to your forms that only spambots can see, you can trick them into revealing that they are spam bots and not actual end-users.</p> <p>Here we have a simple checkbox that:</p> <ul><li>Is hidden with CSS.</li> <li>Has an obscure but obviously fake name.</li> <li>Has a default value equivalent 0.</li> <li>Can't be filled by auto-complete</li> <li>Can't be navigated to via the Tab key. (See tabindex)</li> </ul><h3>Install / Implement Honeypot on drupal.</h3> <p>Just install and configure drupal Honeypot contrib module.</p> <h3><br /> Install / Implement Honeypot on custom PHP Website.</h3> <h4>HTML Code</h4> <p><code>&lt;input type="checkbox" name="contact_me_by_fax_only" value="1" style="display:none !important" tabindex="-1" autocomplete="off"&gt;</code></p> <p> </p> <h4>Server-Side</h4> <p>On the server side we want to check to see if the value exists and has a value other than 0, and if so handle it appropriately. This includes logging the attempt and all the submitted fields.</p> <p>In PHP it might look something like this:</p> <p><code>$honeypot = FALSE;<br /> if (!empty($_REQUEST['contact_me_by_fax_only']) &amp;&amp; (bool) $_REQUEST['contact_me_by_fax_only'] == TRUE) {<br />     $honeypot = TRUE;<br />     log_spambot($_REQUEST);<br />     // treat as spambot<br /> } else {<br />     // process as normal<br /> }</code></p> <h2><br /> An Example of Honeypot php class for easy implementation.</h2> <h3>PHP Class</h3> <p><code>&lt;?php<br /><br /> class Honeypot {<br /><br />   const FIELD_NAME = "contact_me_by_fax_only";<br /><br />   /**<br />    * Get Honeypot form input field.<br />    * @return string<br />    */<br />   public static function getHoneypot() {<br />     $field_name = self::FIELD_NAME;<br />     $form_input = '&lt;input type="checkbox" name="' . $field_name . '" value="1" style="display:none !important" tabindex="-1" autocomplete="off"&gt;';<br />     return $form_input;<br />   }<br /><br />   /**<br />    * Check the form submission.<br />    * @return bool<br />    */<br />   public static function checkHoneypot() {<br />     $honeypot = FALSE;<br />     $field_name = self::FIELD_NAME;<br />     if (!empty($_REQUEST[$field_name]) &amp;&amp; (bool) $_REQUEST[$field_name] == TRUE) {<br />       $honeypot = TRUE;<br />     }<br />     return $honeypot;<br />   }<br /> }</code></p> <p> </p> <h3>Usage:</h3> <h4>At the form creation:</h4> <p><code>&lt;form&gt;<br />     ...<br />   &lt;?php print Honeypot::getHoneypot(); ?&gt;<br />     ...<br /> &lt;/form&gt;</code></p> <h4><br /> At the form submission:</h4> <p><code>if (Honeypot::checkHoneypot()) {<br />   // Probably a spam.<br /> }<br /> else {<br />   // Probably not a spam.<br /> }</code></p> <p> </p> <p>Source : http://stackoverflow.com/questions/36227376/better-honeypot-implementation-form-anti-spam</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> <li><a href="/en/tags/form" hreflang="en">Form</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=296&amp;2=comment&amp;3=comment" token="ec8dd685"></drupal-render-placeholder> </section> Thu, 16 Mar 2017 09:14:04 +0000 editor 296 at http://drupal8.ovh Avoid email send by Php/Drupal mark as spam http://drupal8.ovh/en/tutoriels/291/avoid-email-send-by-php-drupal-mark-as-spam <span class="field field--name-title field--type-string field--label-hidden">Avoid email send by Php/Drupal mark as spam</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to avoid an email send with drupal php mark as a junk mail ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Mon, 02/13/2017 - 12:19</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>An email is classified as spam or not spam on the receiving end, not the sending end. But you can improve</p> <p> Use email authentication methods, such as SPF, and DKIM to prove that your emails and your domain name belong together, and to prevent spoofing of your domain name. The SPF website includes a wizard to generate the DNS information for your site.</p> <p>Check your reverse DNS to make sure the IP address of your mail server points to the domain name that you use for sending mail.</p> <p>Make sure that the IP-address that you're using is not on a blacklist</p> <p>Make sure that the reply-to address is a valid, existing address.</p> <p>Use the full, real name of the addressee in the To field, not just the email-address (e.g. "John Smith" &lt;john@yourdomain.com&gt; ).</p> <p>Monitor your abuse accounts, such as abuse@yourdomain.com and postmaster@yourdomain.com. That means - make sure that these accounts exist, read what's sent to them, and act on complaints.</p> <p>Finally, make it really easy to unsubscribe. Otherwise, your users will unsubscribe by pressing the spam button, and that will affect your reputation.</p> <p>That said, getting Hotmail to accept your emails remains a black art.</p> <p> Add DKIM on Postfix / ubuntu</p> <p>Tutorial : https://help.ubuntu.com/community/Postfix/DKIM</p> <p> Tips for a server using Debian/Ubuntu and Virtualmin.</p> <p>Add DKIM (DomainKeys Identified Mail) from Virtualmin</p> <p>Active / Install DomainKeys Identified Mail (DKIM) from virtualmin<br />     Virtualmin -&gt; Email messages -&gt; DomainKeys Identified Mail<br />     - Install if not already done.<br />     - Set 'Selector for DKIM record name' Example : 'email'<br />     - Add or Exclude domains<br />     - Then add public key shown on 'DNS records for additional domains' to your DNS.</p> <p> Configure the domain to use in outbound mail (Postfix Mail Server)</p> <p>- If you want to use a single domain name for all virtual servers, set it on  /etc/mailname<br /> - Configure domain on:<br />     Webmin -&gt; Servers -&gt; Postfix Mail Server -&gt; General Options</p> <p>Configure DNS for DKIM</p> <p>Selector : Example :  selector._domainkey.yourdomain.com</p> <p> </p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> <li><a href="/en/tags/server" hreflang="en">Server</a></li> <li><a href="/en/tags/linux" hreflang="en">Linux</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=291&amp;2=comment&amp;3=comment" token="3dc3448d"></drupal-render-placeholder> </section> Mon, 13 Feb 2017 11:19:58 +0000 editor 291 at http://drupal8.ovh HTML Entity Decode and Encode http://drupal8.ovh/en/tutoriels/241/html-entity-decode-and-encode <span class="field field--name-title field--type-string field--label-hidden">HTML Entity Decode and Encode</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to Encode and decode HTML entitys with drupal 8 ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Tue, 10/04/2016 - 11:59</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Basic php and drupal 7 / 8 Examples</h2> <p>1.<br /><code>$string_out = html_entity_decode($string, ENT_QUOTES, 'UTF-8')</code><br /> //Do not forget ENT_QUOTES and 'UTF-8', otherwise quotes will not decodes.</p> <p>2.<br /><code>$string_out = check_plain($string)</code><br /> //Same as : <code>$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');</code></p> <p>3.</p> <h3>Transliterate</h3> <p><code>$string = "The string to transliterate";<br /> $trans = \Drupal::transliteration();<br /> $string = $trans-&gt;transliterate($string, 'en');</code></p> <p> </p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/drupal-7" hreflang="en">Drupal 7</a></li> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=241&amp;2=comment&amp;3=comment" token="e8e2d2c0"></drupal-render-placeholder> </section> Tue, 04 Oct 2016 09:59:58 +0000 editor 241 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/241/html-entity-decode-and-encode#comments Isset() VS Empty() VS Is_null() http://drupal8.ovh/en/tutoriels/228/isset-vs-empty-vs-null <span class="field field--name-title field--type-string field--label-hidden">Isset() VS Empty() VS Is_null()</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>What are the different between isset(), !empty(), !is_null() ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 09/01/2016 - 13:23</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Those are three functions allow you to determine <span lang="en" xml:lang="en"><span>the nature of</span> a <span>variable, with a bit different.</span></span></p> <p> </p> <p>Comparison table</p> <table class="text-align-center"><thead><tr><th>$value</th> <th>gettype($value)</th> <th>isset($value)</th> <th>!empty($value)</th> <th>!is_null($value)</th> </tr></thead><tbody><tr><td>0</td> <td>integer</td> <td>TRUE</td> <td>-</td> <td>TRUE</td> </tr><tr><td>NULL</td> <td>NULL</td> <td>-</td> <td>-</td> <td>-</td> </tr><tr><td>FALSE</td> <td>boolean</td> <td>TRUE</td> <td>-</td> <td>TRUE</td> </tr><tr><td>$undefined</td> <td>NULL</td> <td>-</td> <td>-</td> <td>-</td> </tr><tr><td>""</td> <td>string</td> <td>TRUE</td> <td>-</td> <td>TRUE</td> </tr><tr><td>TRUE</td> <td>boolean</td> <td>TRUE</td> <td>TRUE</td> <td>TRUE</td> </tr><tr><td>1</td> <td>integer</td> <td>TRUE</td> <td>TRUE</td> <td>TRUE</td> </tr><tr><td>"TXT"</td> <td>string</td> <td>TRUE</td> <td>TRUE</td> <td>TRUE</td> </tr></tbody></table><p>More details  : http://php.net/manual/en/types.comparisons.php</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=228&amp;2=comment&amp;3=comment" token="095952c2"></drupal-render-placeholder> </section> Thu, 01 Sep 2016 11:23:39 +0000 editor 228 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/228/isset-vs-empty-vs-null#comments Install PHP 5 (5.4, 5.5, 5.6) and PHP 7 on Linux http://drupal8.ovh/en/tutoriels/178/how-to-install-php-on-linux <span class="field field--name-title field--type-string field--label-hidden">Install PHP 5 (5.4, 5.5, 5.6) and PHP 7 on Linux</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to Install PHP 5.4 or PHP 5.5 or PHP 5.6 on debian based linux (Mint 17, 18..., Ubuntu 12, 14,16 ...) using PPA ?</p> <p>How to Install PHP 7 on Linux  (Debian, Ubuntu, Mint ...) ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/nuwantha" typeof="schema:Person" property="schema:name" datatype="">nuwantha</span></span> <span class="field field--name-created field--type-created field--label-hidden">Sat, 07/02/2016 - 11:45</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Via PPA</h2> <h2>Install PHP 5.4 On linux (Debian, Ubuntu, Mint ...)</h2> <p><code>sudo apt-get install python-software-properties<br /> sudo add-apt-repository ppa:ondrej/php5-oldstable<br /> sudo apt-get update<br /> sudo apt-get install -y php5</code></p> <p>NOTE:<br /> If you have this message <strong>add-apt-repository: command not found</strong><br /> run : <code>apt-get install software-properties-common</code></p> <h2> Install PHP 5.5</h2> <p><code>sudo apt-get install python-software-properties<br /> sudo add-apt-repository ppa:ondrej/php<br /> sudo apt-get update<br /> sudo apt-get install -y php5.5</code></p> <h2>Install PHP 5.6 On linux (Debian, Ubuntu, Mint ...)</h2> <p><code>sudo apt-get install python-software-properties<br /> sudo add-apt-repository ppa:ondrej/php<br /> sudo apt-get update<br /> sudo apt-get install -y php5.6</code></p> <p> </p> <h2>Install PHP 7 On linux (Debian, Ubuntu, Mint ...)</h2> <p><code>sudo apt-get install python-software-properties<br /> sudo add-apt-repository ppa:ondrej/php<br /> sudo apt-get update<br /> sudo apt-get install -y php7.0</code></p> <p> </p> <h3>Check Installed PHP Version</h3> <p><code>php -v</code></p> <p> </p> <h2>Install PHP 5.6 Modules</h2> <p>Show available PHP Modules list<br /><code>sudo apt-cache search php5.6-* </code></p> <h3>Install modules which is required for you.<br /> Example PHP 5.6:<br /><code>sudo apt-get install libapache2-mod-php5.6 php5.6-cgi php5.6-cli php5.6-curl php5.6-imap php5.6-gd php5.6-mysql php5.6-pgsql php5.6-sqlite3 php5.6-mbstring php5.6-json php5.6-bz2 php5.6-mcrypt php5.6-xmlrpc php5.6-gmp php5.6-xsl php5.6-soap php5.6-xml php5.6-zip php5.6-dba</code></h3> <p>Example PHP 7:<br /><code>sudo apt-get install libapache2-mod-php7.0 php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-gd</code></p> <p> </p> <p>PHP 5.6 Modules list (Example)</p> <p><code>php-amqp - AMQP extension for PHP<br /> php-apcu - APC User Cache for PHP<br /> php-geoip - GeoIP module for PHP<br /> php-igbinary - igbinary PHP serializer<br /> php-imagick - Provides a wrapper to the ImageMagick library<br /> php-mongodb - MongoDB driver for PHP<br /> php-msgpack - PHP extension for interfacing with MessagePack<br /> php-oauth - OAuth 1.0 consumer and provider extension<br /> php-redis - PHP extension for interfacing with Redis<br /> php-rrd - PHP bindings to rrd tool system<br /> php-smbclient - PHP wrapper for libsmbclient<br /> php-solr - PHP extension for communicating with Apache Solr server<br /> php-ssh2 - Bindings for the libssh2 library<br /> php-uuid - PHP UUID extension<br /> php-yac - YAC (Yet Another Cache) for PHP<br /> php-zmq - ZeroMQ messaging bindings for PHP<br /> php-radius - radius client library for PHP<br /> php-http - PECL HTTP module for PHP Extended HTTP Support<br /> php-uploadprogress - file upload progress tracking extension for PHP<br /> libapache2-mod-php5.6 - server-side, HTML-embedded scripting language (Apache 2 module)<br /> php5.6-cgi - server-side, HTML-embedded scripting language (CGI binary)<br /> php5.6-cli - command-line interpreter for the PHP scripting language<br /> php5.6-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)<br /> php5.6-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)<br /> libphp5.6-embed - HTML-embedded scripting language (Embedded SAPI library)<br /> php5.6-dev - Files for PHP5.6 module development<br /> php5.6-common - documentation, examples and common module for PHP<br /> php5.6 - server-side, HTML-embedded scripting language (metapackage)<br /> php5.6-curl - CURL module for PHP<br /> php5.6-gd - GD module for PHP<br /> php5.6-imap - IMAP module for PHP<br /> php5.6-intl - Internationalisation module for PHP<br /> php5.6-ldap - LDAP module for PHP<br /> php5.6-mysql - MySQL module for PHP<br /> php5.6-pgsql - PostgreSQL module for PHP<br /> php5.6-pspell - pspell module for PHP<br /> php5.6-recode - recode module for PHP<br /> php5.6-snmp - SNMP module for PHP<br /> php5.6-sqlite3 - SQLite3 module for PHP<br /> php5.6-sybase - Sybase module for PHP<br /> php5.6-tidy - tidy module for PHP<br /> php5.6-opcache - Zend OpCache module for PHP<br /> php-xdebug - Xdebug Module for PHP<br /> php5.6-json - JSON module for PHP<br /> php-memcached - memcached extension module for PHP, uses libmemcached<br /> php5.6-bz2 - bzip2 module for PHP<br /> php5.6-mcrypt - libmcrypt module for PHP<br /> php5.6-odbc - ODBC module for PHP<br /> php5.6-readline - readline module for PHP<br /> php5.6-interbase - Interbase module for PHP<br /> php5.6-xmlrpc - XMLRPC-EPI module for PHP<br /> php5.6-enchant - Enchant module for PHP<br /> php5.6-gmp - GMP module for PHP<br /> php5.6-xsl - XSL module for PHP (dummy)<br /> php-memcache - memcache extension module for PHP<br /> php-gmagick - Provides a wrapper to the GraphicsMagick library<br /> php5.6-bcmath - Bcmath module for PHP<br /> php5.6-mbstring - MBSTRING module for PHP<br /> php5.6-soap - SOAP module for PHP<br /> php5.6-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP<br /> php5.6-zip - Zip module for PHP<br /> php-tideways - Tideways PHP Profiler Extension<br /> php-mailparse - Email message manipulation for PHP<br /> php-propro - propro module for PHP<br /> php-raphf - raphf module for PHP<br /> php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP<br /> php-gearman - PHP wrapper to libgearman<br /> php-xcache - fast, stable PHP opcode cacher<br /> php-mongo - MongoDB database driver<br /> php5.6-dba - DBA module for PHP<br /> php-xhprof - Hierarchical Profiler for PHP 5.x</code></p> <p> </p> <h3>PHP 7 Modules list (Example)</h3> <p><code>php7.0-common - Common files for packages built from the PHP source<br /> libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)<br /> php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)<br /> php7.0-cli - command-line interpreter for the PHP scripting language<br /> php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)<br /> php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)<br /> libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)<br /> php7.0-dev - Files for PHP7.0 module development<br /> php7.0-dbg - Debug symbols for PHP7.0<br /> php7.0-curl - CURL module for PHP<br /> php7.0-gd - GD module for PHP<br /> php7.0-imap - IMAP module for PHP<br /> php7.0-intl - Internationalisation module for PHP<br /> php7.0-ldap - LDAP module for PHP<br /> php7.0-pgsql - PostgreSQL module for PHP<br /> php7.0-pspell - pspell module for PHP<br /> php7.0-recode - recode module for PHP<br /> php7.0-snmp - SNMP module for PHP<br /> php7.0-tidy - tidy module for PHP<br /> php7.0-json - JSON module for PHP<br /> php-all-dev - package depending on all supported PHP development packages<br /> php7.0-sybase - Sybase module for PHP<br /> php7.0-modules-source - PHP 7.0 modules source package<br /> php7.0-sqlite3 - SQLite3 module for PHP<br /> php7.0-mysql - MySQL module for PHP<br /> php7.0-opcache - Zend OpCache module for PHP</code></p> <p> </p> <p> </p> <p>Via DotDeb (for debian linux)</p> <p>Add deb repository to /etc/apt/sources.list.d/dotdeb.list</p> <p>For Debian 8<br /><code>echo "deb http://packages.dotdeb.org jessie all" &gt;&gt; /etc/apt/sources.list.d/dotdeb.list</code></p> <p>For Debian 7<br /><code>echo "deb http://packages.dotdeb.org wheezy-php56 all" &gt;&gt; /etc/apt/sources.list.d/dotdeb.list<br /> echo "deb-src http://packages.dotdeb.org wheezy-php56 all" &gt;&gt; /etc/apt/sources.list.d/dotdeb.list </code></p> <p>Then<br /><code>wget -O- https://www.dotdeb.org/dotdeb.gpg | apt-key add -<br /> apt update</code></p> <p>Remove If another version installed</p> <p><code>systemctl stop php5-fpm<br /> apt-get autoremove --purge php5*</code></p> <p>Install PHP 7 for apache</p> <p>apt install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-gd php7.0-mcrypt php7.0-msgpack php7.0-memcached php7.0-intl php7.0-sqlite3 php7.0-gmp php7.0-geoip php7.0-mbstring php7.0-xml php7.0-zip</p> <h3>If you want to install php5.6 on debian 8 (Jessie)</h3> <p><code>apt-get -y install php5 libapache2-mod-php5 </code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/server" hreflang="en">Server</a></li> <li><a href="/en/tags/shell" hreflang="en">Shell</a></li> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/177/install-lamp-on-debian-based-linux" hreflang="en">Install LAMP On Debian based Linux</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title">Comments</h2> <a id="comment-99"></a> <article role="article" data-comment-user-id="0" about="/en/comment/99" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden" data-comment-timestamp="1478428229"></span> <footer class="comment__meta"> <article typeof="schema:Person" about="/user/0" class="profile"> </article> <p class="comment__author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Oleg Abrazhaev (not verified)</span></span> </p> <p class="comment__time">Sun, 11/06/2016 - 11:30 <span property="schema:dateCreated" content="2016-11-06T10:30:29+00:00" class="rdf-meta hidden"></span> </p> <p class="comment__permalink"><a href="/en/comment/99#comment-99" hreflang="en">Permalink</a></p> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/en/comment/99#comment-99" class="permalink" rel="bookmark" hreflang="en">How I could install libevent-0.1.0 from pecl?</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>I have installed both php5.6 and php7.0 on my Ubuntu and now I want to install libevent to php7<br /> It's alreadey installed for php5.6 but how to install it to php7.0 too?</p> <p>I have tied this commands and it's doesn't help<br />  </p> <p>sudo update-alternatives --set php /usr/bin/php7.0</p> <p>sudo pecl config-set php_ini /etc/php/7.0/cli/php.ini<br /> sudo pecl config-set ext_dir /usr/lib/php/20151012/<br /> sudo pecl config-set bin_dir /usr/bin/<br /> sudo pecl config-set php_bin /usr/bin/php7.0<br /> sudo pecl config-set php_suffix 7</p> <p> pecl list still shows me that libevent installed, but it's in modules list only for php5.6 ...</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=99&amp;1=default&amp;2=en&amp;3=" token="fa8a28ec"></drupal-render-placeholder> </div> </article> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=178&amp;2=comment&amp;3=comment" token="f70c3132"></drupal-render-placeholder> </section> Sat, 02 Jul 2016 09:45:13 +0000 nuwantha 178 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/178/how-to-install-php-on-linux#comments Correct a broken HTML file or a HTML String http://drupal8.ovh/en/tutoriels/163/correct-a-broken-html-file-or-a-html-string <span class="field field--name-title field--type-string field--label-hidden">Correct a broken HTML file or a HTML String</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to correct a broken or faulty written a HTML file or a HTML String ?</p> <p>How to correct faulty and chopped off html with Drupal 8  filters?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Mon, 06/13/2016 - 13:05</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Example 1 : With DOMDocument: (Fast (0.0002 sec) but can have php warning)</p> <p><code>$datas = '&lt;div&gt;&lt;p&gt;Hello';<br /> $doc = new DOMDocument();<br /> $doc-&gt;loadHTML('&lt;?xml encoding="UTF-8"&gt;' . $datas);<br /> $datas_new = $doc-&gt;saveHTML($doc-&gt;documentElement-&gt;firstChild-&gt;firstChild);</code></p> <p>Example 2  With Drupal 8 Utility: (Slow (0.01 sec) but correct way)</p> <p><code>$text_new = \Drupal\Component\Utility\Html::normalize($text);</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/utility" hreflang="en">Utility</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=163&amp;2=comment&amp;3=comment" token="81bf780d"></drupal-render-placeholder> </section> Mon, 13 Jun 2016 11:05:37 +0000 editor 163 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/163/correct-a-broken-html-file-or-a-html-string#comments Open URL with name and password (Apache Htaccess, FTP ...) http://drupal8.ovh/en/tutoriels/127/open-url-name-and-password-apache-htaccess-ftp <span class="field field--name-title field--type-string field--label-hidden">Open URL with name and password (Apache Htaccess, FTP ...)</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to open /call an URL with name and password of Apache Htaccess, FTP ... ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Mon, 04/04/2016 - 10:24</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Examples with username and password:</p> <p><code>https://name:pass@yourdomain.com</code></p> <p><code>ftp://name:pass@yourdomain.com<br /> ​ftp://name:pass@ftp.yourdomain.com</code></p> <p><code>ssh name:pass@yourdomain.com</code></p> <p>Examples with username:</p> <p><code>​ftp://name@ftp.yourdomain.com</code></p> <p><code>ssh name@yourdomain.com</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/linux" hreflang="en">Linux</a></li> <li><a href="/en/tags/server" hreflang="en">Server</a></li> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=127&amp;2=comment&amp;3=comment" token="aff4bcdb"></drupal-render-placeholder> </section> Mon, 04 Apr 2016 08:24:35 +0000 editor 127 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/127/open-url-name-and-password-apache-htaccess-ftp#comments SSL self signed / Override certificate check http://drupal8.ovh/en/tutoriels/126/ssl-self-signed-override-certificate-check <span class="field field--name-title field--type-string field--label-hidden">SSL self signed / Override certificate check</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to Override SSL certificate check (https://) on linux / PHP / Apache / cURL ... ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Mon, 04/04/2016 - 10:17</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>On linux (wget)</p> <p><code>wget --no-check-certificate https://yourdomain.com<br /> wget --no-check-certificate https://name:pass@yourdomain.com</code></p> <p>On Apache PHP</p> <p><code>$context=array(<br />     "ssl"=&gt;array(<br />         "verify_peer"=&gt;false,<br />         "verify_peer_name"=&gt;false,<br />     ),<br /> );  <br /> $response = file_get_contents("https://yourdomain.com", false, stream_context_create($context));</code></p> <p>On PHP cURL:</p> <p><code>curl_setopt($rCURL, CURLOPT_SSL_VERIFYPEER, false);</code></p> <p>Other Solutions:<br /> TODO</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/linux" hreflang="en">Linux</a></li> <li><a href="/en/tags/shell" hreflang="en">Shell</a></li> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> <li><a href="/en/tags/ssl-tls" hreflang="en">SSL/TLS</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=126&amp;2=comment&amp;3=comment" token="0ecd3835"></drupal-render-placeholder> </section> Mon, 04 Apr 2016 08:17:04 +0000 editor 126 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/126/ssl-self-signed-override-certificate-check#comments