Kloxo - Upgrade PHP version to PHP 5.4.x




Kloxo, by default install PHP 5.2.x. There is no options in Kloxo to upgrade php to higher versions.


root@kloxo ~]# php -v
PHP 5.2.17 (cli) (built: Dec 18 2013 16:48:28)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

The steps given below will help you to update the php version to PHP 5.4.x.

Copy and paster the following contents into the file (/usr/local/lxlabs/kloxo/file/phpini/htaccesstemp), which is the template of php.ini for php 5.4.x .

php_value upload_max_filesize 128M
php_value max_execution_time  120
php_value max_input_time  -1
php_value memory_limit  128M
php_value post_max_size  128M
php_flag display_errors  __lx__display_error_flag
php_flag file_uploads  __lx__file_uploads_flag
php_flag log_errors  __lx__log_errors_flag
php_flag output_buffering  __lx__output_buffering_flag
php_flag register_argc_argv  __lx__register_argc_argv_flag
php_flag mysql.allow_persistent  __lx__mysql_allow_persistent_flag
php_flag register_long_arrays  __lx__register_long_arrays_flag
php_flag allow_url_fopen  __lx__allow_url_fopen_flag
php_flag cgi.force_redirect  __lx__cgi_force_redirect_flag
php_flag enable_dl  __lx__enable_dl_flag

Inorder to protect the file from Kloxo updates,
[root@kloxo ~]# chattr +i /usr/local/lxlabs/kloxo/file/phpini/htaccesstemp

Copy and paster the following contents into the file (/usr/local/lxlabs/kloxo/file/phpini/php.ini.temp), which is the template of php.ini for php 5.4.x .

[PHP]
engine = On
asp_tags = Off
precision = 14
output_buffering = __lx__output_buffering_flag
zlib.output_compression = __lx__output_compression_flag
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions = shell_exec
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 180
max_input_time = -1
memory_limit = 128M
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
display_errors = __lx__display_error_flag
display_startup_errors = Off
log_errors = __lx__log_errors_flag
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = __lx__register_argc_argv_flag
auto_globals_jit = On
post_max_size = 128M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = __lx__enable_dl_flag
file_uploads = __lx__file_uploads_flag
upload_max_filesize = 128M
max_file_uploads = 20
allow_url_fopen = __lx__allow_url_fopen_flag
allow_url_include = __lx__allow_url_include_flag
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = __lx__mysql_allow_persistent_flag
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.save_path = __lx__session_save_path_flag
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]

date.timezone = "Europe/Warsaw"

zend_extension=/usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.4.so
zend_extension=/usr/lib/php/modules/opcache.so
extension=/usr/lib/php/modules/apc.so

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.save_comments=0
opcache.enable_file_override=1



Inorder to protect the file from Kloxo updates,

[root@kloxo ~]# chattr +i /usr/local/lxlabs/kloxo/file/phpini/php.ini.temp

 Download IonCube loaders for PHP 5.4 and unpack them into: /usr/lib/kloxophp/ioncube

[root@kloxo kloxophp]# cd /usr/lib/kloxophp

If your architecture is 64 bit,

[root@kloxo kloxophp]# wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz


If your architecture is 32 bit,

[root@kloxo kloxophp]# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

[root@kloxo kloxophp]# tar -xzvf ioncube_loaders_lin_*.tar.gz



Download and Install Zend Optimizer

[root@kloxo ~]# curl -LOk https://github.com/zendtech/ZendOptimizerPlus/archive/master.zip
[root@kloxo ~]# unzip master.zip
[root@kloxo ~]# cd ZendOptimizerPlus-master
[root@kloxo ZendOptimizerPlus-master]# /usr/bin/phpize
[root@kloxo ZendOptimizerPlus-master]#  ./configure  --with-php-config=/usr/bin/php-config
[root@kloxo ZendOptimizerPlus-master]# make && make install



Download and Install Remi repository for PHP 5.4

[root@kloxo ~]# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
[root@kloxo ~]# wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
[root@kloxo ~]# rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm


Update the PHP version using remi repository,

[root@kloxo ~]# yum update php --enablerepo=remi


Install APC cache,

[root@kloxo ~]# pecl install apc


To update the php.ini file as we configured earlier.

[root@kloxo ~]# /script/fixphp


Depending upon the webservice you are running, restart apache or lighttpd.

[root@kloxo ~]# /etc/init.d/httpd restart
or
[root@kloxo ~]# /etc/init.d/lighttpd restart



Ensure Ioncube is loaded in php.ini,

[root@kloxo ~]# grep ioncube_loader /etc/php.ini
zend_extension=/usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.4.so


Ensure opcache is loaded in php.ini,

[root@kloxo ~]# grep opcache.so /etc/php.ini
zend_extension=/usr/lib/php/modules/opcache.so


Ensure APC is loaded in php.ini,

[root@kloxo ~]# grep apc.so /etc/php.ini
extension=/usr/lib/php/modules/apc.so


Once everything discussed above is setup, you will get the following result..

[root@kloxo ~]# php -v
PHP 5.4.25 (cli) (built: Feb 11 2014 09:00:15)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

That's it..!!

This entry was posted in by Arun Ghosh. Bookmark the permalink.

6 thoughts on “Kloxo - Upgrade PHP version to PHP 5.4.x”

  1. Hi, thank for tutorial. But I can't login to ftp account after upgrade? It's has a conflict? How I can resolving this problem. Hope you reply soon

  2. http://www.sudosu.in/2014/02/kloxo-pure-ftpd-relocation-error-pure.html

    this may be the one you are having the problem with the FTP.. Just try this...

  3. got error when install APC
    [root@localhost ~]# pecl install apc
    Failed loading /usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.2.so: /usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.2.so: undefined symbol: php_body_write
    Cannot load Zend Extension Manager - it was built with configuration 1.2.0, whereas running engine is API220100525,NTS

    thanks!

  4. I get an error

    [root@sf ~]# php -v
    Failed loading /usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.4.so: /usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.4.so: wrong ELF class: ELFCLASS32
    PHP Warning: Module 'apc' already loaded in Unknown on line 0
    PHP Warning: Module 'Zend OPcache' already loaded in Unknown on line 0
    PHP Warning: Zend OPcache: module registration failed! in Unknown on line 0
    PHP 5.4.42 (cli) (built: Jun 12 2015 07:24:46)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies
    *** glibc detected *** php: free(): invalid pointer: 0x00002afa9744faf8 ***
    ======= Backtrace: =========
    /lib64/libc.so.6[0x2afa8d62d74f]
    /lib64/libc.so.6(cfree+0x4b)[0x2afa8d631a4b]
    php(php_module_shutdown+0x25)[0x56e565]
    php[0x675505]
    /lib64/libc.so.6(__libc_start_main+0xf4)[0x2afa8d5d99c4]
    php[0x421089]
    ======= Memory map: ========