Archiwum kategorii: PHP

Instalacja Ioncube Loader Debian

64Bit x86_64 Linux:

tar xfz ioncube_loaders_lin_x86-64.tar.gz

32Bit i386 Linux:

tar xfz ioncube_loaders_lin_x86.tar.gz

cp ioncube /usr/local/

ls /usr/local/ioncube

root@wheezy:/usr/local# ls /usr/local/ioncube LICENSE.txt loader-wizard.php README.txt USER-GUIDE.pdf USER-GUIDE.txt

php -v

PHP 5.6.31-1~dotdeb+7.1 (cli) (built: Jul 11 2017 06:53:16)
Copyright (c) 1997-2016 The PHP Group

wersja php to 5.6 ioncube powinien byc 5.6 =>

vim /etc/php5/apache2/php.ini

vim /etc/php5/cli/php.ini

na początku pliku dodać:

zend_extension = /usr/local/php5/ioncube/

Extra field and column in users WordPress

Put this code in the theme’s functions file -> following path:


function new_contact_methods( $contactmethods ) {
    $contactmethods['phone'] = 'Phone Number';
	$contactmethods['birthdate'] = 'Birthdate';
	$contactmethods['handicap'] = 'Handicap';
    return $contactmethods;
add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 );

function new_modify_user_table( $column ) {
    $column['phone'] = 'Phone';
    $column['birthdate'] = 'Birthdate';
	$column['handicap'] = 'Handicap';
    return $column;
add_filter( 'manage_users_columns', 'new_modify_user_table' );

function new_modify_user_table_row( $val, $column_name, $user_id ) {
     switch ($column_name) {
        case 'phone' :
            return get_the_author_meta( 'phone', $user_id );
        case 'birthdate' :
            return get_the_author_meta( 'birthdate', $user_id );
		case 'handicap' :
            return get_the_author_meta( 'handicap', $user_id );
    return $val;
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );


Errors in PHP

To display PHP errors on the web the variables in php.ini need to be change:

vim /etc/php5/apache2/php.ini

; Quick Reference ;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.

; display_errors
; Default Value: On
; Development Value: On
; Production Value: On

; display_startup_errors
; Default Value: Off
Development Value: On
Production Value: Off

Restart Apache:
# service apache2 restart

to check if the settings are saved you can use phpinfo(); to display the settings.

It may happened that even the settings in php.ini files are set to show the errors the errors still won’t be displayed as there might be a piece of code overwriting the settings. Then use this piece of code on the top of the file that you suspect is having an error:

ini_set('display_errors', 1);