Xdebug.ini für Remote Debugging in PHPStorm


Komplett voreingestellte xdebug.ini für Ubuntu 14.04 direkt zur Verwendung mit PHPStorm.
Download: xdebug.ini


Code:
[debug]
zend_extension=xdebug.so

; Using Xdebug
;
; Q:  phpinfo() reports that Xdebug is installed and enabled, yet I still don't get any stacktraces when an error
;     happens.
; A1: You have to search through all your PHP libraries and include files for any "set_error_handler" calls.
;     If there are any, you have to either comment it out, or change the body of the handler function to call
;     xdebug_* api functions.
; A2: You do not have set [display_errors] to 1 in php.ini
; Q:  Xdebug doesn't format output.
; A:  Make sure you have PHP's [html_errors] set to 1 in php.ini
; Q:  The debug client doesn't receive any connections, what do I do wrong?
; A:  You probably forgot to set the environment variable or to add the necessary information to your URL. See the
;     documentation for more information.
;
;
; Related Links:
;
; FAQ: http://xdebug.org/docs/faq
; Related Settings: http://www.xdebug.org/docs/all_settings
;
;
; Author: Frank Göldner
; Stand : Nov 2011



; ===| basics |===

; Controls which IDE Key Xdebug should pass on to the DBGp debugger handler. The default is based on environment
; settings. First the environment setting DBGP_IDEKEY is consulted, then USER and as last USERNAME. The default is set
; to the first environment variable that is found. If none could be found the setting has as default ''.
; Type: string, Default value: *complex*
xdebug.idekey = "PHPSTORM"

; This is the base url for the links from the function traces and error message to the manual pages of the function
; from the message. It is advisable to set this setting to use the closest mirror.
; Type: string, Default value: http://www.php.net
xdebug.manual_url = "http://de.php.net/"

; Controls the protection mechanism for infinite recursion protection. The value of this setting is the maximum level
; of nested functions that are allowed before the script will be aborted.
; Type: integer, Default value: 100
xdebug.max_nesting_level = 110



; If this setting is 1, then stacktraces will be shown by default on an error event. You can disable showing
; stacktraces from your code with xdebug_disable(). As this is one of the basic functions of Xdebug, it is advisable
; to leave this setting set to 1.
; Type: boolean, Default value: 1
xdebug.default_enable = 1

; When this setting is set to on, the tracing of function calls will be enabled just before the script is run. This
; makes it possible to trace code in the auto_prepend_file.
; Type: boolean, Default value: 0
;xdebug.auto_trace = 0

; When this setting is set to 1, Xdebug will show a stack trace whenever an exception is raised - even if this
; exception is actually caught.
; Type: integer, Default value: 0
xdebug.show_exception_trace = 0

; If this setting is 1, then Xdebug will disable the @ (shut-up) operator so that notices, warnings and errors are no
; longer hidden.
; Type: boolean, Default value: 0, Introduced in Xdebug 2.1
xdebug.scream = 0

; If this setting is 1, Xdebug will color var_dumps and stack traces output when in CLI mode.
; Type: boolean, Default value: 0, Introduced in Xdebug 2.2
xdebug.cli_color = 1




; ===| level of detail |===

; When this setting is set to something != 0 Xdebug's generated stack dumps in error situations will also show all
; variables in the top-most scope. Beware that this might generate a lot of information, and is therefore turned off
; by default.
; Type: integer, Default value: 0
xdebug.show_local_vars = 0

; When this setting is set to something != 0 Xdebug's human-readable generated trace files will show the difference in
; memory usage between function calls. If Xdebug is configured to generate computer-readable trace files then they will
; always show this information.
; Type: integer, Default value: 0
xdebug.show_mem_delta = 0

; Controls the amount of array children and object's properties are shown when variables are displayed with either
; xdebug_var_dump(), xdebug.show_local_vars or through Function Traces. This setting does not have any influence on the
; number of children that is send to the client through the Remote Debugging feature.
; Type: integer, Default value: 128
xdebug.var_display_max_children = 256

; Controls the maximum string length that is shown when variables are displayed with either xdebug_var_dump(),
; xdebug.show_local_vars or through Function Traces. This setting does not have any influence on the amount of data
; that is send to the client through the Remote Debugging feature.
; Type: integer, Default value: 512
xdebug.var_display_max_data = 1024

; Type: integer, Default value: 3
; Controls how many nested levels of array elements and object properties are when variables are displayed with either
; xdebug_var_dump(), xdebug.show_local_vars or through Function Traces. This setting does not have any influence on the
; depth of children that is send to the client through the Remote Debugging feature.
xdebug.var_display_max_depth = 3

; This setting, defaulting to 0, controls whether Xdebug should add variable assignments to function traces.
; Type: boolean, Default value: 0, Introduced in Xdebug 2.1
xdebug.collect_assignments = 0

; This setting, defaulting to 1, controls whether Xdebug should write the filename used in include(), include_once(),
; require() or require_once() to the trace files.
; Type: boolean, Default value: 1
xdebug.collect_includes = 1

; This setting, defaulting to 0, controls whether Xdebug should collect the parameters passed to functions when a
; function call is recorded in either the function trace or the stack trace.
;
; The setting defaults to 0 because for very large scripts it may use huge amounts of memory and therefore make it
; impossible for the huge script to run. You can most safely turn this setting on, but you can expect some problems in
; scripts with a lot of function calls and/or huge data structures as parameters. Xdebug 2 will not have this problem
; with increased memory usage, as it will never store this information in memory. Instead it will only be written to
; disk. This means that you need to have a look at the disk usage though.
;
; This setting can have four different values. For each of the values a different amount of information is shown. Below
; you will see what information each of the values provides. See also the introduction of the feature Stack Traces for
; a few screenshots.

; Value   Argument Information Shown
; 0       None.
; 1       Type and number of elements (f.e. string(6), array(8)).
; 2       Type and number of elements, with a tool tip for the full information 1.
; 3       Full variable contents (with the limits respected as set by xdebug.var_display_max_children,
;         xdebug.var_display_max_data and xdebug.var_display_max_depth.
; 4       Full variable contents and variable name.
; Type: integer, Default value: 0
xdebug.collect_params = 4

; This setting, defaulting to 0, controls whether Xdebug should write the return value of function calls to the trace
; files.
; Type: boolean, Default value: 0
xdebug.collect_return = 0

; This setting tells Xdebug to gather information about which variables are used in a certain scope. This analysis can
; be quite slow as Xdebug has to reverse engineer PHP's opcode arrays. This setting will not record which values the
; different variables have, for that use xdebug.collect_params. This setting needs to be enabled only if you wish to
; use xdebug_get_declared_vars().
; Type: boolean, Default value: 0
xdebug.collect_vars = 0

; * = COOKIE, FILES, GET, POST, REQUEST, SERVER, SESSION. These seven settings control which data from the superglobals
; is shown when an error situation occurs. Each php.ini setting can consist of a comma seperated list of variables from
; this superglobal to dump, but make sure you do not add spaces in this setting. In order to dump the REMOTE_ADDR and
; the REQUEST_METHOD when an error occurs, add this setting:
; xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
;
; Type: string, Default value: Empty
; xdebug.dump.* = ?

; Controls whether the values of the superglobals as defined by the xdebug.dump.* settings whould be shown or not.
; Type: boolean, Default value: 1
xdebug.dump_globals = 1

; Controls whether the values of the superglobals should be dumped on all error situations (set to 0) or only on the
; first (set to 1).
; Type: boolean, Default value: 1
xdebug.dump_once = 1

; If you want to dump undefined values from the superglobals you should set this setting to 1, otherwise leave it set
; to 0.
; Type: boolean, Default value: 0
xdebug.dump_undefined = 0

; Controls whether Xdebug should enforce 'extended_info' mode for the PHP parser; this allows Xdebug to do file/line
; breakpoints with the remote debugger. When tracing or profiling scripts you generally want to turn off this option as
; PHP's generated oparrays will increase with about a third of the size slowing down your scripts. This setting can not
; be set in your scripts with ini_set(), but only in php.ini.
; Type: integer, Default value: 1
xdebug.extended_info = 1

; By default Xdebug overloads var_dump() with its own improved version for displaying variables when the html_errors
; php.ini setting is set to 1. In case you do not want that, you can set this setting to 0, but check first if it's not
; smarter to turn off html_errors.
; Type: boolean, Default value: 1, Introduced in Xdebug 2.1
xdebug.overload_var_dump = 1




; ===| remote settings |===

; This switch controls whether Xdebug should try to contact a debug client which is listening on the host and port as
; set with the settings xdebug.remote_host and xdebug.remote_port. If a connection can not be established the script
; will just continue as if this setting was 0.
; Type: boolean, Default value: 0
xdebug.remote_enable = 1

; Normally you need to use a specific HTTP GET/POST variable to start remote debugging (see Remote Debugging). When
; this setting is set to 1, Xdebug will always attempt to start a remote debugging session and try to connect to a
; client, even if the GET/POST/COOKIE variable was not present.
; Type: boolean, Default value: 0
xdebug.remote_autostart = 0

; If enabled, the xdebug.remote_host setting is ignored and Xdebug will try to connect to the client that made the HTTP
; request. It checks the $_SERVER['REMOTE_ADDR'] variable to find out which IP address to use. Please note that there
; is no filter available, and anybody who can connect to the webserver will then be able to start a debugging session,
; even if their address does not match xdebug.remote_host.
; Type: boolean, Default value: 0, Introduced in Xdebug 2.1
xdebug.remote_connect_back = 1

; Selects the host where the debug client is running, you can either use a host name or an IP address. This setting is
; ignored if xdebug.remote_connect_back is enabled.
; Type: string, Default value: localhost
xdebug.remote_host = "192......"
; deine UNIDEV IP falls ifconfig gesperrt -> ip -4 -o addr show eth0 | awk -F"[/, ]" '{print $7 }'
;xdebug.remote_host = "127.0.0.1"

; This setting can be used to increase (or decrease) the time that the remote debugging session stays alive via the
; session cookie.
; Type: integer, Default value: 3600, Introduced in Xdebug 2.1
xdebug.remote_cookie_expire_time = 3600

; Can be either 'php3' which selects the old PHP 3 style debugger output, 'gdb' which enables the GDB like debugger
; interface or 'dbgp' - the debugger protocol. The DBGp protocol is more widely supported by clients. See more
; information in the introduction for Remote Debugging.
;
; Note: Xdebug 2.1 and later only support 'dbgp' as protocol.
; Type: string, Default value: dbgp
xdebug.remote_handler = "dbgp"

; If set to a value, it is used as filename to a file to which all remote debugger communications are logged. The file
; is always opened in append-mode, and will therefore not be overwritten by default. There is no concurrency protection
; available. The format of the file looks something like:
; Log opened at 2007-05-27 14:28:15
; ->
;
;
; Type: string, Default value:
; xdebug.remote_log =

; Selects when a debug connection is initiated. This setting can have two different values:
; req
;   Xdebug will try to connect to the debug client as soon as the script starts.
; jit
;   Xdebug will only try to connect to the debug client as soon as an error condition occurs.
; Type: string, Default value: req
xdebug.remote_mode = "req"

; The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the client and the
; bundled debugclient. As many clients use this port number, it is best to leave this setting unchanged.
; Type: integer, Default value: 9000
xdebug.remote_port = 9002




; ===| trace options |===

; When this setting is set to on, the tracing of function calls will be enabled just before the script is run. This
; makes it possible to trace code in the auto_prepend_file.
; Type: boolean, Default value: 0
xdebug.auto_trace = 0

; When this setting is set to 1, you can trigger the generation of trace files by using the XDEBUG_TRACE GET/POST
; parameter, or set a cookie with the name XDEBUG_TRACE. This will then write the trace data to defined directory.
; In order to prevent Xdebug to generate trace files for each request, you need to set xdebug.auto_trace to 0.
; Type: boolean, Default value: 0, Introduced in Xdebug 2.2
xdebug.trace_enable_trigger = 0

; When set to '1' the trace files will be appended to, instead of being overwritten in subsequent requests.
; Type: integer, Default value: 0
xdebug.trace_options = 0

; The directory where the tracing files will be written to, make sure that the user who the PHP will be running as has
; write permissions to that directory.
; Type: string, Default value: /tmp
;xdebug.trace_output_dir = "/data/h.test/projects/_tracer/"

; This setting determines the name of the file that is used to dump traces into. The setting specifies the format with
; format specifiers, very similar to sprintf() and strftime(). There are several format specifiers that can be used to
; format the file name. The '.xt' extension is always added automatically.

; The possible format specifiers are:
;
; Spec Meaning                                  Example Format     Example Filename
; %c   crc32 of the current working directory   trace.%c           trace.1258863198.xt
; %p   pid                                      trace.%p           trace.5174.xt
; %r   random number                            trace.%r           trace.072db0.xt
; %s   script name²                             cachegrind.out.%s  cachegrind.out._home_httpd_html_test_xdebug_test_php
; %t   timestamp (seconds)                      trace.%t           trace.1179434742.xt
; %u   timestamp (microseconds)                 trace.%u           trace.1179434749_642382.xt
; %H   $_SERVER['HTTP_HOST']                    trace.%H           trace.kossu.xt
; %R   $_SERVER['REQUEST_URI']                  trace.%R           trace._test_xdebug_test_php_var=1_var2=2.xt
; %U   $_SERVER['UNIQUE_ID']³                   trace.%U           trace.TRX4n38AAAEAAB9gBFkAAAAB.xt
; %S   session_id (from $_COOKIE if set)        trace.%S           trace.c70c1ec2375af58f74b390bbdd2a679d.xt
; %%   literal %                                trace.%%           trace.%%.xt
;
; ²This one is not available for trace file names.
; ³New in version 2.2. This one is set by Apache's mod_unique_id module
; Type: string, Default value: trace.%c
xdebug.trace_output_name = "trace.%c"

; The format of the trace file.Value  Description
; 0   shows a human readable indented trace file with: time index, memory usage, memory delta (if the setting
;     xdebug.show_mem_delta is enabled), level, function name, function parameters (if the setting
;     xdebug.collect_params is enabled), filename and line number.
; 1   writes a computer readable format which has two different records. There are different records for entering a
;     stack frame, and leaving a stack frame. The table below lists the fields in each type of record. Fields are tab
;     separated.
;
; Fields for the computerized format:
; Record type 1      2           3           4           5             6               7                                           8                                   9           10
; Entry       level  function #  always '0'  time index  memory usage  function name   user-defined (1) or internal function (0)   name of the include/require file    filename    line number
; Exit        level  function #  always '1'  time index  memory usage  -------------------------------------------------------  empty  -------------------------------------------------------
;
; See the introduction of Function Traces for a few examples.
; Type: integer, Default value: 0
xdebug.trace_format = 0




; ===| Profiling |===

; When this setting is set to 1, profiler files will not be overwritten when a new request would map to the same file
; (depnding on the xdebug.profiler_output_name setting. Instead the file will be appended to with the new profile.
; Type: integer, Default value: 0
xdebug.profiler_append = 0

; Enables Xdebug's profiler which creates files in the profile output directory. Those files can be read by KCacheGrind
; to visualize your data. This setting can not be set in your script with ini_set(). If you want to selectively enable
; the profiler, please set xdebug.profiler_enable_trigger to 1 instead of using this setting.
; Type: integer, Default value: 0
xdebug.profiler_enable = 0

; When this setting is set to 1, you can trigger the generation of profiler files by using the XDEBUG_PROFILE GET/POST
; parameter, or set a cookie with the name XDEBUG_PROFILE. This will then write the profiler data to defined directory.
; In order to prevent the profiler to generate profile files for each request, you need to set xdebug.profiler_enable
; to 0.
; Type: integer, Default value: 0
xdebug.profiler_enable_trigger = 0

; The directory where the profiler output will be written to, make sure that the user who the PHP will be running as
; has write permissions to that directory. This setting can not be set in your script with ini_set().
; Type: string, Default value: /tmp
;xdebug.profiler_output_dir = "/data/f.goeldner/projects/profiler/"

; This setting determines the name of the file that is used to dump traces into. The setting specifies the format with
; format specifiers, very similar to sprintf() and strftime(). There are several format specifiers that can be used to
; format the file name.
;
; See the xdebug.trace_output_name documentation for the supported specifiers.
; Type: string, Default value: cachegrind.out.%p
xdebug.profiler_output_name = "cachegrind.out.%p"

Linux Bash History durchsuchen und Limit erhöhen


Linux Bash History durchsuchen und Speicherlimit erhöhen


Viele kennen vielleicht das Problem das man auf der Konsole ein komplexen Befehl ausgeführt hatte aber diesen nicht mehr vollständig kennt. Da in Linux ausgeführte Befehle standardmä0ig in der Bash History (~/.bash_history) gespeichert werden ist es relativ leicht seine bereits genutzten Befehle wieder zu finden. Um die History zu durchsuchen genügt es diesen Befehl auszuführen:

Bash History durchsuchen:
  history | grep "MeinSuchwort"

Die History speichert Standardmäßig 2000 Befehle. Einigen Leuten ist das aber einfach zu wenig und Sie hätten gern das Ihre History 10.000 Einträge speichert. Um das zu ermöglichen muss man folgende Änderungen vornehmen.

Bash History Limit erhöhen:
bashrc bearbeiten:
 
  nano ~/.bashrc

Limit anpassen:
 
  HISTSIZE=10000
  HISTFILESIZE=10000

HISTSIZE - Anzahl der zu speichernden Befehle in der Bash Session
HISTFILESIZE - Anzahl der enthaltenen Zeilen die in die history Datei gespeichert werden

Viel Spass beim erweitern eurer Bast History ;)

PHP Mcrypt Erweiterung installieren (Linux und Windows)


PHP Mcrypt Erweiterung installieren (Linux und Windows)

Heute hatte ich das Problem das die Mcrypt Erweiterung in PHP nicht in meiner VM aktiviert war. Obwohl ich die Erweiterung installiert hatte weigerte sich PHP diese zu benutzen. Dies resultierte in folgenden Fehlermeldungen:
Call to undefined function mcrypt_module_open()
Fatal error: Call to undefined function mcrypt_encrypt()
Durch ein wenig probieren war die Lösung doch einfacher als gedacht. Die Erweiterung wurde einfach nicht vom Apache2 geladen. Durch das Aktivieren und Neustarten des Webservers konnte das Problem gelöst werden und PHP konnte die mcrypt Funktionen ausführen. (PHP 5.5)

Deshalb habe ich hier noch einmal eine kurze Zusammenfassung der Installation und Aktivierung der Mcrypt Erweiterung.  

Anleitung Ubuntu:
  • sudo apt-get install php5-mcrypt
  • sudo service apache2 restart
 // nur benötigt wenn Modul nicht automatisch aktiviert wurde
  • sudo php5enmod mcrypt
  • sudo service apache2 restart  

Anleitung Windows:
  • ;extension=php_mcrypt.dll einkommentieren zu extension=php_mcrypt.dll 
  • Apache Webserver neustarten  

Anleitung Redhat
  • sudo yum install php55-mcrypt //wenn php5.5
  • sudo yum install php-mcrypt //wenn < 5.4 sudo
  • service httpd restart //wenn Apache 2.4
  • sudo /etc/init.d/httpd restart //wenn Apache 2.2 oder niedriger

Um zu überprüfen ob Mcrypt installiert und aktiviert ist kann man einfach eine PHP Datei mit folgendem Inhalt auf seinen Webserver legen. Diese dann aufrufen und die Erweiterung in der Liste suchen.
 <?php phpinfo(); ?>
Wer noch mehr zum Thema Mcrypt wissen will kann gerne noch mal bei PHP.net vorbeischauen.
Link: Mcrypt PHP.net

Android 6 - Nexus 5 Wlan Batterie Bug (Workaround)

Android 6 - Nexus 5 Wlan Batterie Bug / WiFi battery drain on 6.0

Android 6 ist nun seit einiger Zeit draußen und schon gibt es einige kleine Probleme mit den Nexus 5 Usern (bin selbst einer). Viele haben das Problem das in der Akkuverbrauchsliste das Wlan an erster Stelle steht obwohl dieses so gut wie gar nicht benutzt oder aus ist. Hier nun einige Methoden um dieses Problem zu lösen. Methode 2 hatte bei mir Erfolg.

(Workaround & Lösung)

Methode 1 - Safe Boot:
- Smartphone im "Abgesicherten Modus" booten (lange auf den Herunterfahren Button drücken)
- einige Minuten in dem Modus bleiben und alle Widgets von euren Homescreens entfernen
- Gerät neustarten

Methode 2 - Cache Wipe
- in Recovery-Modus booten (Lautstärke runter + Powerbutton)
- im RM die Option "wipe cache partition" wählen
- Gerät neustarten

Methode 3 - Akku rekalibrieren:
- Akku vollständig entleeren (solange warten bis sich das Handy allein abschaltet)
- Smartphone im abgeschaltenen Zustand vollständig aufladen
- Gerät neustarten

Methode 4 - Factory Reset:
- Backup von all deinen Daten machen
- "Einstellungen" -> "Sichern & zurücksetzen" -> "Auf Werkszustand zurück"
- Lesen und Bestätigen
- Gerät neustarten


Wer mehr zu dem Thema wissen möchte sollte vielleicht auch mal in dem dazugehörigen XDA Beitrag reinschauen. XDA Thread

Hat es bei euch geholfen? Schreibt es in die Kommentare :)

Firebug - Löschen aller JS Breakpoints

Firebug - Löschen aller JS Breakpoints / Clear all Firebug JS breakpoints

Entwickler die viel mit dem beliebten Addon "Firebug" hantieren kennen womöglich das Problem mit den nicht löschbaren Javascript Breakpoints. Obwohl im Firebug kein Breakpoint mehr zu sehen ist hält das Programm trotzdem an der Stelle an. Das ist ziemlich nervig darum hier nun eine Lösung:
  1. In die Adressleiste des Browsers einfach "about:support" eingeben
  2. "Ordner öffnen" Button klicken
  3. Ordner "Firebug" suchen und öffnen
  4. Datei "breakpoints.json" löschen oder bearbeiten
  5. Firefox neustarten