Debug http://drupal8.ovh/en/tags/debug en Install Xdebug with NginX Server http://drupal8.ovh/en/tutoriels/333/install-xdebug-nginx-server <span class="field field--name-title field--type-string field--label-hidden">Install Xdebug with NginX Server</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 and configure Xdebug On NginX with an IDE like Netbeans, Phpstorm ... ?</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, 07/24/2017 - 11:26</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Install Xdebug php</h2> <p><code>sudo apt install php-xdebug</code></p> <h2>Configure Xdebug</h2> <p>Example:<br /><strong>sudo gedit /etc/php/5.6/mods-available/xdebug.ini</strong></p> <p>Add (Example)<br /><code>zend_extension=xdebug.so<br /> xdebug.remote_enable=1<br /> xdebug.remote_handler=dbgp<br /> xdebug.remote_mode=req<br /> xdebug.remote_host=localhost<br /> xdebug.remote_port=9000<br /> xdebug.var_display_max_depth = -1<br /> xdebug.var_display_max_children = -1<br /> xdebug.var_display_max_data = -1<br /> xdebug.idekey = "netbeans-xdebug"</code></p> <h3>Restart nginx and php-fem (here php5.6-fpm)</h3> <p><code>sudo /etc/init.d/nginx restart<br /> sudo /etc/init.d/php5.6-fpm restart<br /> # OR<br /> sudo service nginx restart<br /> sudo service php5.6-fpm restart</code></p> <h3>Configre IDE (Here Netbeans)</h3> <p>Goto Tools-&gt;Options-&gt;PHP-&gt;Debuging<br /> Set session ID and Debugger Port if different.</p> <p>Note : Check 'Stop at first line' to test, then uncheck if you do not need.</p> <h2>Tips</h2> <p>On netBeans:<br /> Run your project in debug mode (Ctrl + F5)<br /> View Variables<br /> Step over ( F8 )<br /> Step Into ( F7 )<br /> Step Out ( Ctrl + F7 )<br /> Run to cursor ( F4 )<br /> Continue ( F5 )</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/debug" hreflang="en">Debug</a></li> <li><a href="/en/tags/ide" hreflang="en">IDE</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/109/xdebug-install-and-configure-netbeans" hreflang="en">XDebug - Install and configure with NetBeans</a></div> <div class="field__item"><a href="/en/tutoriels/106/debug-and-display-errors-php-apache-mysql-xdebug" hreflang="en">Debug and Display errors. PHP Apache Mysql Xdebug</a></div> </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=333&amp;2=comment&amp;3=comment" token="DSxFnKL4z2y7PlL4r1E6ULhcAZDrbJ1kU8A56cWc1tg"></drupal-render-placeholder> </section> Mon, 24 Jul 2017 09:26:24 +0000 editor 333 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/333/install-xdebug-nginx-server#comments Drupal coding Standard and Best Practice http://drupal8.ovh/en/tutoriels/327/drupal-coding-standard-and-best-practice <span class="field field--name-title field--type-string field--label-hidden">Drupal coding Standard and Best Practice</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 use <strong>phpcs </strong>and <strong>phpcbf </strong>to check and correct<strong> drupal 8</strong> coding Standard ?</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, 06/29/2017 - 13:05</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><blockquote><p> Create a Drupal 8 module is a good idea, but develop as Drupal is BEST.</p> </blockquote> <p>The famous tools <strong>PhpCS </strong>and <strong>PhpCBF </strong>allow you to check and correct (some) drupal coding standards and best practice errors.</p> <h2>Install Drupal coder.</h2> <p>Step 1. Download drupal coder via drush (<strong>drush dl coder</strong>) or from <strong>https://www.drupal.org/project/coder</strong> and extract into a folder <strong>out side</strong> of the drupal project.<br /> Here, for the example : <strong>/home/myhome/coder</strong></p> <p>Step 2. Download / Install additional packages using composer. (<a data-entity-substitution="canonical" data-entity-type="node" data-entity-uuid="2dac87a1-d882-41c7-815e-a12dce5c74eb" href="/en/tutoriels/202/install-and-update-composer" rel="nofollow">How to install composer</a>)<br /> Example:<br /><code>cd /home/myhome/coder<br /> composer update</code></p> <p>Step 3. Configure envirenement.<br /> Example:<br /><code>export PATH="$PATH:/home/myhome/coder/vendor/bin"<br /> set PATH $PATH /home/myhome/coder/vendor/bin<br /> phpcs --config-set installed_paths /home/myhome/coder/coder_sniffer<br /> phpcbf --config-set installed_paths /home/myhome/coder/coder_sniffer</code></p> <h2> Use PhpCS anf PhpCBF</h2> <p>-&gt; Go to your custom module directory. Example : /var/www/drupal8/modules/custom/mymodule<br /> You can use phpcs using absolute path of the module. But I got <strong><em>some errors when using phpcbf</em></strong>.<br /><strong>phpcs --standard=Drupal /var/www/drupal8/modules/custom/mymodule</strong></p> <p>Example of the Errors :<br /><code>Array<br /> (<br /> [0] =&gt; Ignoring potentially dangerous file name /var/www/drupal8/modules/custom/mymodule.....<br /> [1] =&gt; can't find file to patch at input line 3</code></p> <h3>Check drupal coding Standard errors</h3> <p><code>phpcs --standard=Drupal .<br /> OR<br /> phpcs --standard=Drupal /var/www/drupal8/modules/custom/mymodule</code></p> <h3>Correst some drupal coding Standard errors (Merked as [X])</h3> <p><code>phpcbf --standard=Drupal .<br /> OR<br /> # This may not work : To test<br /> phpcbf --standard=Drupal /var/www/drupal8/modules/custom/mymodule</code></p> <h3>Check drupal Best Practice errors</h3> <p><code>phpcs --standard=DrupalPractice .<br /> OR<br /> phpcs --standard=DrupalPractice /var/www/drupal8/modules/custom/mymodule</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/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/debug" hreflang="en">Debug</a></li> <li><a href="/en/tags/module" hreflang="en">Module</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/202/install-and-update-composer" hreflang="en">Install and Update Composer</a></div> </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=327&amp;2=comment&amp;3=comment" token="PG_cMf-0dyBQ02oeI_IMcBhl6bm5fjx-Op9bqcyn62g"></drupal-render-placeholder> </section> Thu, 29 Jun 2017 11:05:53 +0000 editor 327 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/327/drupal-coding-standard-and-best-practice#comments SimpleTest : Running PHPUnit tests from command line http://drupal8.ovh/en/tutoriels/269/simpletest-running-phpunit-tests <span class="field field--name-title field--type-string field--label-hidden">SimpleTest : Running PHPUnit tests from command line</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 test drupal 8 application using command line (without SimpleTest Admin interface) ?</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">Wed, 12/07/2016 - 17:39</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Initialisation - Create link to the script (Optional).</h2> <p><code>ln -s core/scripts/run-tests.sh ~/bin</code></p> <h2>Run Test and open rest in web browser.</h2> <p><code>php core/scripts/run-tests.sh --browser --class "Drupal\YOUR_MODULE\Tests\JustTest"</code></p> <h2>Run Test and display result in the terminal.</h2> <p><code>php core/scripts/run-tests.sh --verbose --color --class "Drupal\YOUR_MODULE\Tests\JustTest"</code></p> <h2>Run test using a separate SqLite Database.</h2> <p><code>php core/scripts/run-tests.sh --verbose --sqlite test.sqlite --class "Drupal\YOUR_MODULE\Tests\JustTest"</code></p> <h2>Run test verbose mode and open in web browser.</h2> <p><code>php core/scripts/run-tests.sh --verbose --browser --class "Drupal\YOUR_MODULE\Tests\JustTest</code></p> <h2>Clean up Database Tables.</h2> <p><code>php core/scripts/run-tests.sh --verbose --clean</code></p> <p> </p> <p> </p> <p>Link : https://www.drupal.org/docs/8/phpunit/running-phpunit-tests</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/debug" hreflang="en">Debug</a></li> <li><a href="/en/tags/tests" hreflang="en">Tests</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/123/simpletest-drupal-8" hreflang="en">SimpleTest With Drupal 8</a></div> </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=269&amp;2=comment&amp;3=comment" token="HsrgLvKjNiIQag4zn86arzYiVNpY9hN-qBnGmznvEHA"></drupal-render-placeholder> </section> Wed, 07 Dec 2016 16:39:01 +0000 editor 269 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/269/simpletest-running-phpunit-tests#comments XDebug - Install and configure with NetBeans http://drupal8.ovh/en/tutoriels/109/xdebug-install-and-configure-netbeans <span class="field field--name-title field--type-string field--label-hidden">XDebug - Install and configure with NetBeans</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 and configure Xdebug With an IDE (NetBeans, PHPStome ...) ?</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">Sun, 01/24/2016 - 12:23</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Step 1. Install Xdebug<br /> If not already ainstalled, Install Xdebug (I'ts already on the package WAML, LAMP, MAMP)<br /> In Linux Debian/Ubuntu/Mint<br /><code># sudo apt-get install php5-xdebug</code></p> <p>Step 2. Configure the server<br /> Open php.ini and add:<br /><code>[xdebug]<br /> ;The path to the xdebug extention , If not already added<br /> ;zend_extension=/usr/lib/php5/20090626/xdebug.so<br /> ;zend_extension=xdebug.so</code></p> <p><code>xdebug.remote_enable=on<br /> xdebug.remote_handler="dbgp"<br /> xdebug.remote_port=9000</code><br /><code>;IP of your debuging computer (127.0.0.1 if you use a local server)</code><br /><code>;NOTE : Ff you use a VirtualBox VM, Probably you can use the 127.0.0.1 IP<br /> xdebug.remote_host=<strong>127.0.0.1</strong><br /> ;A key to identify your IDE<br /> xdebug.idekey="<strong>netbeans-xdebug</strong>"<br /> xdebug.remote_connect_back=1</code></p> <p>Step 3. Configure your IDE<br /> On Netbeans, Project properties-&gt;Run Configuration -&gt; Project Url (Set project URL</p> <p>Step 4. Configure web browser<br /> - Install xdebug extention on your web browser (On FireFox / Chrome ...)<br /> - Configure with your IDE Key :<strong> netbeans-xdebug</strong></p> <p>Finally, (on NetBeans)</p> <ul><li>Add a BreackPoint (where you want !!!)</li> <li>Run your project in debug mode (<strong>Ctrl + F5</strong>)</li> <li>You can: <ul><li>View Variables</li> <li>Step over ( <strong>F8</strong> )</li> <li>Step Into ( <strong>F7</strong> )</li> <li>Step Out ( <strong>Ctrl + F7</strong> )</li> <li>Run to cursor ( <strong>F4</strong> )</li> <li>Continue ( <strong>F5</strong> )</li> </ul></li> </ul></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/debug" hreflang="en">Debug</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/333/install-xdebug-nginx-server" hreflang="en">Install Xdebug with NginX Server</a></div> </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=109&amp;2=comment&amp;3=comment" token="sSjkqxh7GTkyg29tXkaFAnNK7zYThBjULinxph65WyE"></drupal-render-placeholder> </section> Sun, 24 Jan 2016 11:23:09 +0000 editor 109 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/109/xdebug-install-and-configure-netbeans#comments Debug and Display errors. PHP Apache Mysql Xdebug http://drupal8.ovh/en/tutoriels/106/debug-and-display-errors-php-apache-mysql-xdebug <span class="field field--name-title field--type-string field--label-hidden">Debug and Display errors. PHP Apache Mysql Xdebug</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>Easy ways to display error and debug PHP Apache Mysql, with or without Xdebug</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, 01/18/2016 - 10:24</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Step 1.<br /> Check apache error log (use tail to show in real time)<br /><code># tail -f /var/log/apache2/error.log</code></p> <p>Step 2 : <br /> Check MySQL database connection using <code><strong>mysql -uusername -ppassword</strong></code></p> <p> </p> <p>Note : Install Xdebug (if not already installed) to debug easily</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/debug" hreflang="en">Debug</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/106/debug-and-display-errors-php-apache-mysql-xdebug" hreflang="en">Debug and Display errors. PHP Apache Mysql Xdebug</a></div> <div class="field__item"><a href="/en/tutoriels/333/install-xdebug-nginx-server" hreflang="en">Install Xdebug with NginX Server</a></div> </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=106&amp;2=comment&amp;3=comment" token="EaHgcjlI8ZFeDvgXtE-AeMHOuxtkBvHscvUH7uWWCkI"></drupal-render-placeholder> </section> Mon, 18 Jan 2016 09:24:39 +0000 editor 106 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/106/debug-and-display-errors-php-apache-mysql-xdebug#comments