Archiwum kategorii: PHP

Instalacja Ioncube Loader Debian

64Bit x86_64 Linux:

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfz ioncube_loaders_lin_x86-64.tar.gz

32Bit i386 Linux:

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar xfz ioncube_loaders_lin_x86.tar.gz

cp ioncube /usr/local/

ls /usr/local/ioncube

root@wheezy:/usr/local# ls /usr/local/ioncube
ioncube_loader_lin_4.1.so ioncube_loader_lin_5.4_ts.so
ioncube_loader_lin_4.2.so ioncube_loader_lin_5.5.so
ioncube_loader_lin_4.3.so ioncube_loader_lin_5.5_ts.so
ioncube_loader_lin_4.3_ts.so ioncube_loader_lin_5.6.so
ioncube_loader_lin_4.4.so ioncube_loader_lin_5.6_ts.so
ioncube_loader_lin_4.4_ts.so ioncube_loader_lin_7.0.so
ioncube_loader_lin_5.0.so ioncube_loader_lin_7.0_ts.so
ioncube_loader_lin_5.0_ts.so ioncube_loader_lin_7.1.so
ioncube_loader_lin_5.1.so ioncube_loader_lin_7.1_ts.so
ioncube_loader_lin_5.1_ts.so LICENSE.txt
ioncube_loader_lin_5.2.so loader-wizard.php
ioncube_loader_lin_5.2_ts.so README.txt
ioncube_loader_lin_5.3.so USER-GUIDE.pdf
ioncube_loader_lin_5.3_ts.so USER-GUIDE.txt
ioncube_loader_lin_5.4.so

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 => ioncube_loader_lin_5.6.so

vim /etc/php5/apache2/php.ini

vim /etc/php5/cli/php.ini

na początku pliku dodać:

zend_extension = /usr/local/php5/ioncube/ioncube_loader_lin_5.6.so

Extra field and column in users WordPress

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

/domains/your_domain/public_html/wp-content/themes/your_theme_name/functions.php



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 );
            break;
        case 'birthdate' :
            return get_the_author_meta( 'birthdate', $user_id );
            break;
		case 'handicap' :
            return get_the_author_meta( 'handicap', $user_id );
            break;
        default:
    }
    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); 
error_reporting(E_ALL);