| Server IP : 170.10.162.208 / Your IP : 216.73.216.181 Web Server : LiteSpeed System : Linux altar19.supremepanel19.com 4.18.0-553.69.1.lve.el8.x86_64 #1 SMP Wed Aug 13 19:53:59 UTC 2025 x86_64 User : deltahospital ( 1806) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /tmp/ |
Upload File : |
.TH PHP 1 "2008" "The PHP Group" "Scripting Language"
.SH NAME
.TP 15
php - PHP Command Line Interface 'CLI'
.SH SYNOPSIS
.B php
[options] [
.B \-f ]
.IR file
[[\-\-]
.IR args.\|.\|. ]
.LP
.B php
[options]
.B \-r
.IR code
[[\-\-]
.IR args.\|.\|. ]
.LP
.B php
[options] \-\- [
.IR args.\|.\|. ]
.LP
.SH DESCRIPTION
.B PHP
is a widely\-used general\-purpose scripting language that is especially suited for
Web development and can be embedded into HTML. This is the command line interface
that enables you to do the following:
.P
You can parse and execute files by using parameter \-f followed by the name of the
.IR file
to be executed.
.LP
Using parameter \-r you can directly execute PHP
.IR code
simply as you would do inside a .php file when using the
.B eval()
function.
.LP
If none of \-r or \-f is present but a single parameter is given
then this parameter is taken as the filename to parse and execute (same as
with \-f). If no parameter is present then the standard input is read and
executed.
.SH OPTIONS
.TP 15
.B \-a
Run interactively
.TP
.B \-c \fIpath\fP|\fIfile\fP
Look for
.B php.ini
file in the directory
.IR path
or use the specified
.IR file
.TP
.B \-n
No
.B php.ini
file will be used
.TP
.B \-d \fIfoo\fP[=\fIbar\fP]
Define INI entry
.IR foo
with value
.IR bar
.TP
.B \-e
Generate extended information for debugger/profiler
.TP
.B \-f \fIfile\fP
Parse and execute
.IR file
.TP
.B \-h
This help
.TP
.B \-i
PHP information and configuration
.TP
.B \-l
Syntax check only (lint)
.TP
.B \-m
Show compiled in modules
.TP
.B \-r \fIcode\fP
Run PHP
.IR code
without using script tags
.B '<?..?>'
.TP
.B \-s
Display colour syntax highlighted source
.TP
.B \-v
Version number
.TP
.B \-w
Display source with stripped comments and whitespace
.TP
.B \-z \fIfile\fP
Load Zend extension
.IR file
.TP
.IR args.\|.\|.
Arguments passed to script. Use
.B '\-\-'
.IR args
when first argument starts with
.B '\-'
or script is read from stdin
.SH FILES
.TP 15
.B php\-cli.ini
The configuration file for the CLI version of PHP.
.TP
.B php.ini
The standard configuration file will only be used when
.B php\-cli.ini
cannot not be found.
.SH EXAMPLES
.TP 5
\fIphp -r 'echo "Hello World\\n";'\fP
This command simply writes the text "Hello World" to standard out.
.TP
\fIphp \-r 'print_r(gd_info());'\fP
This shows the configuration of your gd extension. You can use this
to easily check which imag formats you can use. If you have any
dynamic modules you may want to use the same ini file that php uses
when executed from your webserver. There are more extensions which
have such a function. For dba use:
.RS
\fIphp \-r 'print_r(dba_handlers(1));'\fP
.RE
.SH TIPS
You can use a shebang line to automatically invoke php
from scripts. Only the CLI version of PHP will ignore
such a first line as shown below:
.P
.PD 0
.RS
#!/bin/php
.P
<?php
.P
// your script
.P
?>
.RE
.PD 1
.P
.SH SEE ALSO
For a more or less complete description of PHP look here:
.PD 0
.P
.B http://www.php.net/manual/
.PD 1
.P
A nice introduction to PHP by Stig Bakken can be found here:
.PD 0
.P
.B http://www.zend.com/zend/art/intro.php
.PD 1
.SH BUGS
You can view the list of known bugs or report any new bug you
found here:
.PD 0
.P
.B http://bugs.php.net
.PD 1
.SH AUTHORS
The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski.
.P
Additional work for the CLI sapi was done by Edin Kadribasic and Marcus Boerger.
.P
A List of active developers can be found here:
.PD 0
.P
.B http://www.php.net/credits.php
.PD 1
.P
And last but not least PHP was developed with the help of a huge amount of
contributors all around the world.
.SH VERSION INFORMATION
This manpage describes \fBphp\fP, version 4.4.9.
.SH COPYRIGHT
Copyright \(co 1997\-2008 The PHP Group
.LP
This source file is subject to version 3.01 of the PHP license,
that is bundled with this package in the file LICENSE, and is
available through the world-wide-web at the following url:
.PD 0
.P
.B http://www.php.net/license/3_01.txt
.PD 1
.P
If you did not receive a copy of the PHP license and are unable to
obtain it through the world-wide-web, please send a note to
.B license@php.net
so we can mail you a copy immediately.
.TH phpize 1 "2006" "The PHP Group" "Scripting Language"
.SH NAME
.TP 15
phpize - prepare a PHP extension for compiling
.SH SYNOPSIS
.B phpize
[options]
.LP
.SH DESCRIPTION
.B phpize
is a shell script to prepare PHP extension for compiling.
.SH OPTIONS
.TP 15
.PD 0
.B \-\-clean
Remove all created files
.TP
.PD 0
.B \-\-help
Prints usage information
.TP
.PD 0
.B \-\-version
.TP
.PD 1
.B \-v
Prints API version information
.TP
.PD 1
.P
.SH SEE ALSO
.BR php (1)
.SH VERSION INFORMATION
This manpage describes \fBphp\fP, version 4.4.9.
.SH COPYRIGHT
Copyright \(co 1997\-2006 The PHP Group
.LP
This source file is subject to version 3.01 of the PHP license,
that is bundled with this package in the file LICENSE, and is
available through the world-wide-web at the following url:
.PD 0
.P
.B http://www.php.net/license/3_01.txt
.PD 1
.P
If you did not receive a copy of the PHP license and are unable to
obtain it through the world-wide-web, please send a note to
.B license@php.net
so we can mail you a copy immediately.
.TH php\-config 1 "2006" "The PHP Group" "Scripting Language"
.SH NAME
.TP 15
php\-config \- get information about PHP configuration
.SH SYNOPSIS
.B php\-config
[options]
.LP
.SH DESCRIPTION
.B php\-config
is a simple shell script for obtaining information about installed PHP configuration.
.SH OPTIONS
.TP 15
.PD 0
.B \-\-prefix
Directory prefix where PHP is installed, e.g. /usr/local
.TP
.PD 0
.B \-\-includes
List of \-I options with all include files
.TP
.PD 0
.B \-\-ldflags
LD Flags which PHP was compiled with
.TP
.PD 0
.B \-\-libs
Extra libraries which PHP was compiled with
.TP
.PD 0
.B \-\-extension-dir
Directory where extensions are searched by default
.TP
.PD 0
.B \-\-version
PHP version
.TP
.PD 1
.P
.SH SEE ALSO
.BR php (1)
.SH VERSION INFORMATION
This manpage describes \fBphp\fP, version 4.4.9.
.SH COPYRIGHT
Copyright \(co 1997\-2006 The PHP Group
.LP
This source file is subject to version 3.01 of the PHP license,
that is bundled with this package in the file LICENSE, and is
available through the world-wide-web at the following url:
.PD 0
.P
.B http://www.php.net/license/3_01.txt
.PD 1
.P
If you did not receive a copy of the PHP license and are unable to
obtain it through the world-wide-web, please send a note to
.B license@php.net
so we can mail you a copy immediately.
ionCube Loader 11 User Guide
============================
This document describes the available php.ini configuration options of the
ionCube Loader that relate to processing of PHP encoded files, and also the
ionCube24 service. It also describes which encoded files can be run by each
ionCube Loader.
PERFORMANCE OF ENCODED FILES
----------------------------
We recommend that the encoded paths feature (see below) is used
with encoded files in order to maximise performance.
ENCODED FILES
-------------
INI entry: ioncube.loader.encoded_paths
Purpose: Specify the locations of encoded files
The ionCube Loader will normally examine a PHP file before processing
to test whether it is encoded, and will run the file itself if necessary.
Although this checking is very efficient, restricting which files the
Loader tests for being encoded may give extra performance. If set to
a series of paths or files, only files in those locations are tested.
Entries should be separated by a : on Unix and ; on Windows.
A path may be prefixed with + or - to add or remove that path from
the possible locations. + is assumed if no character is given.
Examples: (... means ioncube.loader.encoded_paths)
* Site with a single encoded module in /var/www/html/modules/RSS
... = "/var/www/html/modules/RSS"
* As above, with a site configuration file encoded too.
... = "/var/www/html/modules/RSS:/var/www/html/config/config.php"
* Encoded files may be anywhere except for /var/www/html/framework
... = "/:-/var/www/html/framework"
* Site with most modules encoded except for one
... = "/var/www/html/modules:-/var/www/html/modules/plain"
* As above, with an encoded config file in the plain directory
... = "/site/modules:-/site/modules/plain:/site/modules/plain/config.php"
Locations:
The ioncube.loader.encoded_paths property can be set in a php.ini
file, in a .htaccess file (when using Apache), in a .user.ini file
(when using CGI PHP 5.3+) or using ini_set within a PHP script. In ini
files only the last value will be used for the encoded_paths property. If
you wish to build up the value in several lines then, for PHP 5.1+, you
can use the following syntax:
ioncube.loader.encoded_paths = "/path1"
ioncube.loader.encoded_paths = ${ioncube.loader.encoded_paths}":/path2"
; etc...
LIMITATIONS OF LOADERS AND ENCODED FILES
----------------------------------------
Encoded files can, in general, run on versions of PHP equal to
or greater than the source language of the Encoder used to
produce them. So a file produced by the Encoder for PHP 5.3
can be run by the Loaders for PHP 5.3, 5.4, 5.5 and PHP 5.6. This
means that the Loaders are highly backwards compatible. However, there
are the following limitations:
* The Loader for PHP 7.1 can only run files produced by the
Encoder for PHP 7.1 included in the version 10 Encoder.
* The Loader for PHP 7.0 can only run files produced by the
Encoder for PHP 5.6.
* The Loaders for PHP 5.5 and PHP 5.6 cannot run files
produced by the PHP 4 Encoder.
IONCUBE24 : real-time intrusion protection and PHP error reporting
---------
### (Available for Linux 32 and 64 bit x86 servers)
ionCube24 (https://ioncube24.com) is an ionCube service that uses the
ionCube Loader to provide both real-time protection against the exploit of
website vulnerabilities and alerting of website errors.
Vulnerabilities in PHP applications are common, particularly in sites using
Wordpress and other plugin based systems. Exploits result in website
defacement or customer data being compromised, and ionCube24 provides a
uniquely powerful defense.
PHP errors can cause intermittent or even persistent blank pages or errors for
visitors until discovered, and without active monitoring this could go
undetected indefinitely. ionCube24 active monitoring ensures you are always
aware of problems in your website code.
ionCube24 is free to try, with the server side support built into the Linux
Loaders as standard. With the Loader installed, ionCube24 can be activated
at any time to give active intrusion protection and error reporting.
## php.ini settings
ionCube24 has a powerful real-time web interface to configure, monitor and
manage things, and there are also settings that can be used in a php.ini
file as summarised below.
The setup process at https://ioncube24.com automatically gives the settings
that you need to get started, but you may wish to make changes yourself
once setup. The default values are given with each example.
### Global settings
INI entry: ic24.enable ; default 0
Purpose: Enable or disable all ionCube24 features.
This defaults to 0 (off), and in this case no ionCube24 behaviour is
activated.
Example:
ic24.enable = 1
----------
INI entry: ic24.api_access_key ; provided during setup
Purpose: An authentication key for adminstration requests.
This value is provided when adding a server to ionCube24.
----------
INI entry: ic24.api_check_ip ; default 1
Purpose: Specify whether the IP for admin requests should be validated
If set, ionCube24 refuses access to API functions unless the calling IP
is a known ionCube IP address. This option should be left with the
default setting unless web requests pass through a proxy and your site
appears to be accessed from the IP of the proxy instead of ionCube. Note
that access to API functions will still be authenticated by access key.
----------
INI entry: ic24.api_max_timeout ; default 7
Purpose: Maximum timeout period when sending notifications to ionCube24.
The actual period is adaptive so that a brief increase in typical latency
will favour a timeout followed by a retry rather than a longer than usual
timeout.
----------
INI entry: ic24.home_dir ; no default
Purpose: The home directory for ionCube24 related system files.
A location outside of the web root is recommended. It should be writable
by the web server during startup.
Example:
ic24.home_dir = /var/www/ic24_home
----------
INI entry: ic24.update_domains_retry_interval ; default 30
Purpose: The number of seconds to wait before retrying a fetch of the set
of domains being managed.
### Security related settings
INI entry: ic24.sec.enable ; default "auto"
Purpose: Enable the intrusion protection feature of ionCube24.
Accepted values:
* "auto" (default) - allow setting from the ionCube24 control panel.
* 1 : always enabled.
* 0 : disabled.
----------
INI entry: ic24.sec.initial_state ; default 1
Purpose: The default for whether security should be enabled or
disabled. The default is to enable protection. Any files on a protected
domain will become blocked if they are changed, so setting this to 0 will
avoid accidental blocking when using ionCube24 for the first time.
Protection may be enabled and disabled using the ionCube24 control panel and
also via the User API.
Accepted values:
* 1 : protection will be active when ionCube24 initialises.
* 0 : protection will be disabled.
----------
INI entry: ic24.sec.initial_action ; default "block"
Purpose: The initial setting for how new and modified files should be
treated when about to execute. The default is to block. The action is taken
only if protection is enabled, and the setting may be changed via the
ionCube24 control panel.
Accepted values:
* "block" : prevent execution of new or modified files
* "allow" : allow execution of new or modified files
Note that depending on the notification settings, a notification may still
be generated when a new or modified file is about to execute even if it is
not blocked.
----------
INI entry: ic24.sec.initial_notify ; default "always"
Purpose: The initial setting for whether a notification is generated the
first time an unacknowledged new or modified file is attempted to be
executed. This setting can be changed via the ionCube24 control panel.
Accepted values:
* "always" : always notify of a new modification
* "once" : only the first detected modification is reported
* "never" : never notify of new and modified files
----------
INI entry: ic24.sec.exclusion_key ; provided during setup
Purpose: A key that if present at the start of a file, will identify the
file as trusted. This value is provided when adding a server to ionCube24.
----------
INI entry: ic24.sec.trusted_include_paths ; no default
Purpose: List paths from where files can be included and automatically
trusted.
Example:
ic24.sec.trusted_include_paths = "/var/cache:/var/cache2"
Directories can be excluded from the list by prefixing with a minus
character -. e.g.
"/var/cache:-/var/cache/subdir"
This is useful if your site creates and/or modifies files by itself from
time to time, e.g. in a cache directory. Requests that *directly* access
files on a trusted include path will be blocked but the file itself will
not be blocked, so requests that use the file as intended will still work.
See ioncube24.com for more details once signed up. As an alternative, if
possible we recommend producing files that include the exclusion key.
----------
INI entry: ic24.sec.block_uploaded_files ; default 1
Purpose: If set, block any uploaded files in ionCube24 that are processed
using the standard PHP mechanism for uploaded files. This applies even if
the file is subsequently included and where included files being
automatically approved with the previous setting.
----------
INI entry: ic24.sec.block_stdin ; default 1
Purpose: Refuse code that PHP sees via stdin. If disabled, code via
stdin will run without security checking as there is no filepath. This
setting should be left on as PHP would normally never receive a script via
stdin.
### PHP Error reporting settings
INI entry: ic24.phperr.enable ; default "auto"
Purpose: Enable reporting of PHP errors to ionCube24. When enabled, any
non-ignored errors are reported to ionCube24 in realtime, triggering
alerting so errors can be investigated as necessary.
Accepted values:
* "auto" (default) - allow setting from the ionCube24 control panel.
* 1 : always enabled.
* 0 : disabled.
----------
### Deprecated settings
Deprecated settings are subject to removal in a future
release.
INI entry: ic24.phperr.ignore ; default 0
Purpose: Specify default error levels to always ignore for all domains.
Note that default and per-domain errors to ignore can also be set via the
web interface, and are combined with this setting. Leaving this unset and
using the web interface is recommended for maximum flexibility.
Example:
ic24.phperr.ignore = E_NOTICE | E_DEPRECATED
(c) ionCube Ltd. 2021
The ionCube Loader
------------------
This package contains:
* ionCube Loaders
* a Loader Wizard script to assist with Loader installation (loader-wizard.php)
* the License document for use of the Loader and encoded files (LICENSE.txt)
* User Guide describing options that can be configured through a php.ini file.
There are options that may improve performance, particularly with files on
a network drive. Options for the ionCube24 intrusion protection and PHP error
reporting service (ioncube24.com) are also described.
INSTALLATION
============
Quick Guide for experienced system admins
-----------------------------------------
The Loader is a PHP engine extension, so should be referenced with
a zend_extension line in a php.ini file. It must be the first engine
extension to be installed.
The Loader must be for the correct operating system, match the
PHP version, and for whether PHP is built as thread-safe (TS) or not.
All information required for installing is available on a phpinfo page.
For example, if your web server is 64 bit Linux, thread safety is disabled,
PHP is version 7.3.15, the main php.ini file is /etc/php.ini and you
have unpacked Loaders to /usr/local/ioncube, you would:
1) edit /etc/php.ini
2) at the top of the php.ini file add
zend_extension = /usr/local/ioncube/ioncube_loader_lin_7.3.so
3) restart the PHP environment (i.e. Apache, php-fpm, etc.)
4) Check a phpinfo page and the Loader should show up in the Zend Engine box.
Assisted Installation with the Loader Wizard
--------------------------------------------
1. Upload the contents of this package to a directory/folder called ioncube
within the top level of your web scripts area. This is sometimes called the
"web root" or "document root". Common names for this location are "www",
"public_html", and "htdocs", but it may be different on your server.
2. Launch the Loader Wizard script in your browser. For example:
https://yourdomain/ioncube/loader-wizard.php
If the wizard is not found, check carefully the location on your server
where you uploaded the Loaders and the wizard script.
3. Follow the steps given by the Loader Wizard. If you have full access to the
server then installation should be easy. If your hosting plan is more limited,
you may need to ask your hosting provider for assistance.
4. The Loader Wizard can automatically create a ticket in our support system
if installation is unsuccessful, and we are happy to assist in that case.
YouTube with a search for "ioncube loader wizard" also gives some helpful
examples of installation.
WHERE TO INSTALL THE LOADERS
============================
The Loader Wizard should be used to guide the installation process but the
following are the standard locations for the Loader files. Loader file
packages can be obtained from https://www.ioncube.com/loaders.php
Please check that you have the correct package of Loaders for your system.
Installing to a remote SHARED server
------------------------------------
* Upload the Loader files to a directory/folder called ioncube within your
main web scripts area. (This will probably be where you placed the
loader-wizard.php script.)
Installing to a remote UNIX/LINUX DEDICATED or VPS server
---------------------------------------------------------
* Upload the Loader files to the PHP extensions directory or, if that is
not set, /usr/local/ioncube
** Installing to a remote WINDOWS DEDICATED or VPS server
* Upload the Loader files to the PHP extensions directory or, if that is
not set, C:\windows\system32
64-BIT LOADERS FOR WINDOWS
--------------------------
64-bit Loaders for Windows are available for PHP 5.5 upwards.
The Loader Wizard will not give directions for installing 64-bit Loaders for
any earlier version of PHP 5.
Copyright (c) 2002-2020 ionCube Ltd. Last revised 26-February-2020
LICENCE AGREEMENT FOR THE IONCUBE PHP LOADER, PROVIDED TO ENABLE THE USE
OF IONCUBE ENCODED FILES AND AS PART OF THE IONCUBE24 SERVICE (ioncube24.com)
YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS BEFORE USING THE
LOADER SOFTWARE. THE INSTALLATION AND/OR USE OR COPYING OF THE IONCUBE PHP
LOADER SOFTWARE INDICATES YOUR ACCEPTANCE OF THIS LICENCE AGREEMENT. IF YOU
DO NOT ACCEPT THE TERMS OF THIS LICENCE AGREEMENT, DO NOT INSTALL, COPY
AND/OR USE THE LOADER SOFTWARE.
DEFINITIONS
The following definitions shall apply in this document:
LOADER shall mean the ionCube PHP Loader software package or collection
of Loaders, including any modifications or upgrades to the software, used for
executing PHP scripts previously encoded with the ionCube PHP Encoder
software to render them non-humanly readable, and any associated
documentation or electronic or online materials relating to the software.
ENCODER shall mean any ionCube PHP Encoder software or service used for the
purpose of producing non-humanly readable encoded files from PHP scripts.
ENCODED FILE shall mean a non-humanly readable file produced by the
Encoder and being derived from humanly readable PHP script source.
PROVIDER shall mean ionCube Ltd.
USER/YOU shall mean any entity who has downloaded or obtained through any
other means a version of the Loader software.
1 LICENSE ENTITLEMENT
1.1 The Loader is provided without charge. Title to the Loader does not pass
to the user in any circumstances. The Loader is supplied as object code.
1.2 The provider grants a personal, non-transferable, non-exclusive licence to
use the Loader in accordance with the terms and conditions of this Licence
Agreement.
1.3 The installation or downloading and use of the Loader entitles the user
to install and use the Loader for its own internal lawful purposes.
2 DISTRIBUTION
2.1 The Loader may be freely distributed to third parties alone or as
part of a distribution containing other items provided that this license
is also included.
2.2 The Loader may under no circumstances be branded as another product,
whether distributed or not.
2.3 Distribution as part of a commercial product is permitted provided such
distribution is in accordance with clauses 2.1 and 2.2 with respect to the
Loader.
3 ANALYSIS / REVERSE ENGINEERING / MODIFICATION
Except insofar as the user is permitted to do so in accordance with applicable
law:
3.1 Any analysis of the Loader and embedded data by any means and by
any entity whether human or otherwise and including but without limitation to
discover details of internal operation, to reverse engineer, to de-compile
object code, or to modify for the purposes of modifying behaviour is
forbidden.
3.2 Any analysis of encoded files by any means and by any entity whether human
or otherwise and including but without limitation to discover details of file
format or for the purposes of modifying behaviour or scope of their usage is
forbidden.
4 WARRANTY
THE LOADER SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
WARRANTIES INCLUDING BUT WITHOUT LIMITATION THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR PURPOSE ARE
DISCLAIMED. THE PROVIDER DOES NOT WARRANT THAT THE LOADER IS UNINTERRUPTED
OR ERROR FREE, NOR THAT THE OPERATION OF THE LOADER WILL FUNCTION IN
CONJUNCTION WITH ANY OTHER PRODUCT.
5 LIMITATION OF LIABILITY
5.1 IN NO EVENT WILL THE PROVIDER OF THE LOADER BE LIABLE TO THE USER OR ANY
PARTY FOR ANY DIRECT, INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR OTHER
CONSEQUENTIAL DAMAGES ARISING DIRECTLY OR INDIRECTLY FROM THIS LICENCE
AGREEMENT OR ANY USE OF THE LOADER OR ENCODED FILES, EVEN IF THE PROVIDER IS
EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
5.2 THE LOADER IS PROVIDED ON AN "AS IS" BASIS. THE PROVIDER EXCLUDES ALL
WARRANTIES, CONDITIONS, TERMS, UNDERTAKINGS AND REPRESENTATIONS (EXCLUDING
FRAUDULENT MISREPRESENTATION) OF ANY KIND, EXPRESS OR IMPLIED, STATUTORY OR
OTHERWISE IN CONNECTION WITH THE LOADER TO THE FULLEST EXTENT PERMITTED BY
LAW.
5.3 DOWNLOADING THE LOADER IS AT YOUR OWN RISK AND THE PROVIDER DOES NOT
ACCEPT LIABILITY FOR ANY DIRECT OR INDIRECT LOSS OR DAMAGE HOWSOEVER CAUSED AS
A RESULT OF ANY COMPUTER VIRUSES, BUGS, TROJAN HORSES, WORMS, SOFTWARE BOMBS
OR OTHER SIMILAR PROGRAMS ARISING FROM YOUR USE OF THE LOADER. WHILST THE
PROVIDER WILL DO ITS BEST TO ENSURE THAT THE LOADER IS FREE FROM SUCH
DESTRUCTIVE PROGRAMS, IT IS YOUR RESPONSIBILITY TO TAKE REASONABLE PRECAUTIONS
TO SCAN FOR SUCH DESTRUCTIVE PROGRAMS DOWNLOADED FROM THE INTERNET.
5.4 THE PROVIDER'S MAXIMUM LIABILITY FOR ANY LOSS OR DAMAGE ARISING FROM THIS
LICENCE AGREEMENT SHALL IN ANY EVENT BE LIMITED IN THE SOLE DISCRETION OF THE
PROVIDER TO THE REPLACEMENT OF THE LOADER PRODUCT.
5.5 DUE TO THE NATURE OF THE INTERNET, THE PROVIDER CANNOT GUARANTEE THAT ANY
E-MAILS OR OTHER ELECTRONIC TRANSMISSIONS WILL BE SENT TO YOU OR RECEIVED BY
THE PROVIDER OR THAT THE CONTENT OF SUCH TRANSMISSIONS WILL BE SECURE DURING
TRANSMISSION.
6 BUG FIXING AND PRODUCT SUPPORT
6.1 The provider will use reasonable endeavours to provide support to users.
The provider will at their discretion only provide support for the latest
release.
6.2 Support comprises of fault reporting via tickets and fault diagnosis,
recommendations on workarounds, and where reasonably possible a timely
resolution.
6.3 The user accepts that on occasion the ability of the provider to meet
anticipated or published support schedules may be impaired due to, but without
limitation, Internet service provider failures or software failures that
affect the ability to communicate for an indeterminate period.
6.4 The provider reserves the right to refuse to provide support at any time.
6.5 The provider wishes to maintain and offer a product of the highest
possible quality, and accordingly may from time to time and at its discretion
make product changes for the purpose of correcting behaviour in variance to
the published specification or the user's reasonable expectations.
6.6 The provider reserves the right to charge for support where the user does
not have a valid support plan in place, or where the support offered exceeds
the scope of the active support plan.
7 PRODUCT UPGRADES
7.1 The provider may from time to time release product upgrades. These will
be provided free of charge and attempts made to provide a timely notification
to customers of the existence of any new release.
8 ERRORS AND OMISSIONS
Whilst reasonable endeavours are made to ensure the accuracy of documentation
concerning the details of the Loader, the user accepts the possibility of
inaccuracies in information presented in any format, including email
communications and online services. The provider shall under no circumstances
be liable for any events that arise as a result of unintentional inaccuracies
or omissions.
9 USER INDEMNITY
You agree to fully indemnify, defend and hold the provider harmless
immediately upon demand from and against all actions, liability, claims,
losses, damages, costs and expenses (including legal/attorney fees) incurred
by the provider arising directly or indirectly as a result of your breach of
this Licence Agreement.
10 INTELLECTUAL PROPERTY RIGHTS
10.1 The user acknowledges that the Loader and associated documentation and
materials contain proprietary information of the provider and are and shall
remain the exclusive property of the provider and/or its licensors and all
title, copyright, trade marks, trade names, patents and other intellectual
property rights therein of whatever nature shall remain the sole property of
the provider and/or its licensors.
10.2 No title to or rights of ownership, copyright or other intellectual
property in the Loader is transferred to the user (other than the licence
rights expressly granted in this Licence Agreement).
11 TERMINATION
11.1 The provider reserves the right to terminate this Licence Agreement
immediately by notice in writing against the user if the user is in breach of
any terms and conditions of this Licence Agreement.
11.2 Termination of this Licence Agreement for any reason shall be without
prejudice to any other rights or remedies of the provider which may have
arisen on or before the date of termination under this Licence Agreement or in
law.
11.3 The provisions of the following clauses shall survive any termination of
this agreement; clause 3, 5, 10 and 13.
12 GENERAL
12.1 The provider reserves the right to transfer or assign all or any of its
rights and duties and responsibilities set out in this Licence Agreement to
another party.
12.2 Headings have been included for convenience only and will not be used in
construing any provision of this Licence Agreement.
12.3 No delay or failure by the provider to exercise any powers, rights or
remedies under this Licence Agreement will operate as a waiver of them nor
will any single or partial exercise of any such powers, rights or remedies
include any other or further exercise of them.
12.4 If any part of this Licence Agreement is found by a court of competent
jurisdiction or other competent authority to be invalid, unlawful or
unenforceable then such part shall be severed from the remainder of this
Licence Agreement which will continue to be valid and enforceable to the
fullest extent permitted by applicable law.
12.5 This Licence Agreement including the documents or other sources referred
to herein supersede all prior representations, understandings and agreements
between the user and the provider relating to the Loader and sets forth the
entire agreement and understanding between the user and the provider relating
to the Loader.
12.6 Nothing in this Licence Agreement shall be deemed to constitute a
partnership between you and the provider nor constitute either party being an
agent of the other party.
12.7 This Agreement does not create any rights or benefits enforceable by any
person not a party to it (within the meaning of the U.K.Contracts (Rights of
Third Parties) Act 1999) except that a person who under clause 12.1 is a
permitted successor or assignee of the rights or benefits of the provider may
enforce such rights or benefits.
13 GOVERNING LAW AND JURISDICTION
This License Agreement and any issues relating thereto shall be construed and
interpreted in accordance with the laws of England and subject to the
exclusive jurisdiction of the English courts.
Copyright (c) 2002-2020 ionCube Ltd. Last revised 23-April-2015
<?php // -*- c++ -*-
/**
* ionCube Loader install Wizard
*
* ionCube is a registered trademark of ionCube Ltd.
*
* Copyright (c) ionCube Ltd. 2002-2020
*/
define ('ERROR_UNKNOWN_OS',1);
define ('ERROR_UNSUPPORTED_OS',2);
define ('ERROR_UNKNOWN_ARCH',3);
define ('ERROR_UNSUPPORTED_ARCH',4);
define ('ERROR_UNSUPPORTED_ARCH_OS',5);
define ('ERROR_WINDOWS_64_BIT',6);
define ('ERROR_PHP_UNSUPPORTED',7);
define ('ERROR_PHP_DEBUG_BUILD',8);
define ('ERROR_RUNTIME_EXT_DIR_NOT_FOUND',101);
define ('ERROR_RUNTIME_LOADER_FILE_NOT_FOUND',102);
define ('ERROR_INI_NOT_FIRST_ZE',201);
define ('ERROR_INI_WRONG_ZE_START',202);
define ('ERROR_INI_ZE_LINE_NOT_FOUND',203);
define ('ERROR_INI_LOADER_FILE_NOT_FOUND',204);
define ('ERROR_INI_NOT_FULL_PATH',205);
define ('ERROR_INI_NO_PATH',206);
define ('ERROR_INI_NOT_FOUND',207);
define ('ERROR_INI_NOT_READABLE',208);
define ('ERROR_INI_MULTIPLE_IC_LOADER_LINES',209);
define ('ERROR_INI_USER_INI_NOT_FOUND',210);
define ('ERROR_INI_USER_CANNOT_CREATE',211);
define ('ERROR_LOADER_UNEXPECTED_NAME',301);
define ('ERROR_LOADER_NOT_READABLE',302);
define ('ERROR_LOADER_PHP_MISMATCH',303);
define ('ERROR_LOADER_NONTS_PHP_TS',304);
define ('ERROR_LOADER_TS_PHP_NONTS',305);
define ('ERROR_LOADER_WRONG_OS',306);
define ('ERROR_LOADER_WRONG_ARCH',307);
define ('ERROR_LOADER_WRONG_GENERAL',308);
define ('ERROR_LOADER_WIN_SERVER_NONWIN',321);
define ('ERROR_LOADER_WIN_NONTS_PHP_TS',322);
define ('ERROR_LOADER_WIN_TS_PHP_NONTS',323);
define ('ERROR_LOADER_WIN_PHP_MISMATCH',324);
define ('ERROR_LOADER_WIN_COMPILER_MISMATCH',325);
define ('ERROR_LOADER_NOT_FOUND',380);
define ('ERROR_LOADER_PHP_VERSION_UNKNOWN',390);
define ('SERVER_UNKNOWN',0);
define ('HAS_PHP_INI',1);
define ('SERVER_SHARED',2);
define ('SERVER_VPS',5);
define ('SERVER_DEDICATED',7);
define ('SERVER_LOCAL',9);
define ('IONCUBE_IP_ADDRESS',
'94.101.154.134');
define ('IONCUBE_ACCESS_ADDRESS',
'lwaccess.ioncube.com');
define ('LOADERS_PAGE',
'https://loaders.ioncube.com/');
define ('SUPPORT_SITE',
'https://support.ioncube.com/');
define ('WIZARD_SUPPORT_TICKET_DEPARTMENT',
'3');
define ('LOADER_FORUM_URL',
'https://forum.ioncube.com/viewforum.php?f=4');
define ('LOADERS_FAQ_URL',
'https://www.ioncube.com/faqs/loaders.php');
define ('UNIX_ERRORS_URL',
'https://www.ioncube.com/loaders/unix_startup_errors.php');
define ('LOADER_WIZARD_URL',
LOADERS_PAGE);
define ('ENCODER_URL',
'https://www.ioncube.com/sa_encoder.php');
define ('LOADER_VERSION_URL',
'https://www.ioncube.com/feeds/product_info/versions.php');
define ('WIZARD_LATEST_VERSION_URL',
LOADER_VERSION_URL . '?item=loader-wizard');
define ('PHP_COMPILERS_URL',
LOADER_VERSION_URL . '?item=php-compilers');
define ('LOADER_PLATFORM_URL',
LOADER_VERSION_URL . '?item=loader-platforms-all');
define ('LOADER_LATEST_VERSIONS_URL',
LOADER_VERSION_URL . '?item=loader-versions');
define ('LOADER_PHP_VERSION_URL',
LOADER_VERSION_URL . '?item=loader-php-support');
define ('WIZARD_STATS_URL',
'https://www.ioncube.com/feeds/stats/wizard.php');
define ('IONCUBE_DOWNLOADS_SERVER',
'https://downloads.ioncube.com/loader_downloads');
define ('IONCUBE24_URL',
'https://ioncube24.com');
define ('IONCUBE_CONNECT_TIMEOUT',4);
define ('DEFAULT_SELF','/ioncube/loader-wizard.php');
define ('LOADER_NAME_CHECK',true);
define ('LOADER_EXTENSION_NAME','ionCube Loader');
define ('LOADER_SUBDIR','ioncube');
define ('WINDOWS_IIS_LOADER_DIR', 'system32');
define ('ADDITIONAL_INI_FILE_NAME','00-ioncube.ini');
define ('UNIX_SYSTEM_LOADER_DIR','/usr/local/ioncube');
define ('RECENT_LOADER_VERSION','4.0.7');
define ('LATEST_LOADER_MAJOR_VERSION',10);
define ('LOADERS_PACKAGE_PREFIX','ioncube_loaders_');
define ('SESSION_LIFETIME_MINUTES',360);
define ('WIZARD_EXPIRY_MINUTES',2880);
define ('IONCUBE_WIZARD_EXPIRY_MINUTES',10080);
define ('MIN_INITIALISE_TIME',4);
define ('IC24_ENABLED_INI_PROPERTY',"ic24.enable");
run();
function php4_http_build_query($formdata, $numeric_prefix = null, $key = null ) {
$res = array();
foreach ((array)$formdata as $k=>$v) {
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
if ($key) $tmp_key = $key.'['.$tmp_key.']';
if ( is_array($v) || is_object($v) ) {
$res[] = php4_http_build_query($v, null , $tmp_key);
} else {
$res[] = $tmp_key."=".urlencode($v);
}
}
$separator = ini_get('arg_separator.output');
return implode($separator, $res);
}
function script_version()
{
return "2.69";
}
function retrieve_latest_wizard_version()
{
$v = false;
$s = trim(remote_file_contents(WIZARD_LATEST_VERSION_URL));
if (preg_match('/^\d+([.]\d+)*$/', $s)) {
$v = $s;
}
return $v;
}
function latest_wizard_version()
{
if (!isset($_SESSION['latest_wizard_version'])) {
$_SESSION['latest_wizard_version'] = retrieve_latest_wizard_version();
}
return $_SESSION['latest_wizard_version'];
}
function update_is_available($lv)
{
if (is_numeric($lv)) {
$lv_parts = explode('.',$lv);
$script_parts = explode('.',script_version());
return ($lv_parts[0] > $script_parts[0] || ($lv_parts[0] == $script_parts[0] && $lv_parts[1] > $script_parts[1]));
} else {
return null;
}
}
function check_for_wizard_update($echo_message = false)
{
$latest_version = latest_wizard_version();
$update_available = update_is_available($latest_version);
if ($update_available) {
if ($echo_message) {
echo '<p class="alert">An updated version of this Wizard script is available <a href="' . LOADER_WIZARD_URL . '">here</a>.</p>';
}
return $latest_version;
} else {
return $update_available;
}
}
function remote_file_contents($url)
{
$remote_file_opening = ini_get('allow_url_fopen');
$contents = false;
if (isset($_SESSION['timing_out']) && $_SESSION['timing_out']) {
return false;
}
@session_write_close();
$timing_out = 0;
if ($remote_file_opening) {
$fh = @fopen($url,'rb');
if ($fh) {
stream_set_blocking($fh,0);
stream_set_timeout($fh,IONCUBE_CONNECT_TIMEOUT);
while (!feof($fh)) {
$result = fread($fh, 8192);
$info = stream_get_meta_data($fh);
$timing_out = $info['timed_out']?1:0;
if ($timing_out) {
break;
}
if ($result !== false) {
$contents .= $result;
} else {
break;
}
}
fclose($fh);
} else {
$timing_out = 1;
}
} elseif (extension_loaded('curl')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,IONCUBE_CONNECT_TIMEOUT);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
$timing_out = ($info['http_code'] >= 400)?1:0;
curl_close($ch);
if (is_string($output)) {
$contents = $output;
}
} else {
$timing_out = 1;
}
@session_start();
$_SESSION['timing_out'] = $timing_out;
return $contents;
}
function php_version()
{
$v = explode('.',PHP_VERSION);
return array(
'major' => $v[0],
'minor' => $v[1],
'release' => $v[2]);
}
function php_version_maj_min()
{
$vprts = php_version();
return ($vprts['major'] . '.' . $vprts['minor']);
}
function is_supported_php_version()
{
$v = php_version();
return ((($v['major'] == 4) && ($v['minor'] >= 1)) ||
(($v['major'] == 5) && (($v['minor'] >= 1) || ($v['release'] >= 3))) ||
$v['major'] == 7);
}
function is_php_version_or_greater($major,$minor,$release = 0)
{
$version = php_version();
return ($version['major'] > $major ||
($version['major'] == $major && $version['minor'] > $minor) ||
($version['major'] == $major && $version['minor'] == $minor && $version['release'] >= $release));
}
function ini_file_name()
{
$sysinfo = get_sysinfo();
return (!empty($sysinfo['PHP_INI'])?$sysinfo['PHP_INI_BASENAME']:'php.ini');
}
function get_remote_session_value($session_var,$remote_url,$default_function)
{
if (!isset($_SESSION[$session_var])) {
$serialised_res = remote_file_contents($remote_url);
$unserialised_res = @unserialize($serialised_res);
if (empty($unserialised_res)) {
$unserialised_res = call_user_func($default_function);
} else {
$_SESSION['remote_access_successful'] = 1;
}
if (false === $unserialised_res) {
$unserialised_res = '';
}
$_SESSION[$session_var] = $unserialised_res;
}
return $_SESSION[$session_var];
}
function get_file_contents($file)
{
if (function_exists('file_get_contents')) {
$strs = @file_get_contents($file);
} else {
$lines = @file($file);
$strs = join(' ',$lines);
}
return $strs;
}
function default_platform_list()
{
$platforms = array();
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC6', 'is_legacy' => 1, 'os_mod' => '_vc6', 'arch'=>'x86', 'dirname'=>'win32', 'us1-dir'=>'windows_vc6/x86' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC6 (Non-TS)', 'is_legacy' => 1, 'os_mod' => '_nonts_vc6', 'arch'=>'x86', 'dirname'=>'win32-nonts', 'us1-dir'=>'windows_vc6/x86-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC9', 'os_mod' => '_vc9', 'arch'=>'x86', 'dirname'=>'win32_vc9', 'us1-dir'=>'windows_vc9/x86' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC9 (Non-TS)', 'os_mod' => '_nonts_vc9', 'arch'=>'x86', 'dirname'=>'win32-nonts_vc9', 'us1-dir'=>'windows_vc9/x86-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC11', 'os_mod' => '_vc11', 'arch'=>'x86', 'dirname'=>'win32_vc11', 'us1-dir'=>'windows_vc11/x86' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC11 (Non-TS)', 'os_mod' => '_nonts_vc11', 'arch'=>'x86', 'dirname'=>'win32-nonts_vc11', 'us1-dir'=>'windows_vc11/x86-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC11', 'os_mod' => '_vc11', 'arch'=>'x86-64', 'dirname'=>'win64_vc11', 'us1-dir'=>'windows_vc11/amd64' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC11 (Non-TS)', 'os_mod' => '_nonts_vc11', 'arch'=>'x86-64', 'dirname'=>'win64-nonts_vc11', 'us1-dir'=>'windows_vc11/amd64-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC14', 'os_mod' => '_vc14', 'arch'=>'x86', 'dirname'=>'win32_vc14', 'us1-dir'=>'windows_vc14/x86' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC14 (Non-TS)', 'os_mod' => '_nonts_vc14', 'arch'=>'x86', 'dirname'=>'win32-nonts_vc14', 'us1-dir'=>'windows_vc14/x86-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC14', 'os_mod' => '_vc14', 'arch'=>'x86-64', 'dirname'=>'win64_vc14', 'us1-dir'=>'windows_vc14/amd64' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC14 (Non-TS)', 'os_mod' => '_nonts_vc14', 'arch'=>'x86-64', 'dirname'=>'win64-nonts_vc14', 'us1-dir'=>'windows_vc14/amd64-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC15', 'os_mod' => '_vc15', 'arch'=>'x86', 'dirname'=>'win32_vc15', 'us1-dir'=>'windows_vc15/x86' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC15 (Non-TS)', 'os_mod' => '_nonts_vc15', 'arch'=>'x86', 'dirname'=>'win32-nonts_vc15', 'us1-dir'=>'windows_vc15/x86-nonts' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC15', 'os_mod' => '_vc15', 'arch'=>'x86-64', 'dirname'=>'win64_vc15', 'us1-dir'=>'windows_vc15/amd64' );
$platforms[] = array('os'=>'win', 'os_human'=>'Windows VC15 (Non-TS)', 'os_mod' => '_nonts_vc15', 'arch'=>'x86-64', 'dirname'=>'win64-nonts_vc15', 'us1-dir'=>'windows_vc15/amd64-nonts' );
$platforms[] = array('os'=>'lin', 'os_human'=>'Linux', 'arch'=>'x86', 'dirname'=>'linux_i686-glibc2.3.4', 'us1-dir'=>'linux/x86');
$platforms[] = array('os'=>'lin', 'os_human'=>'Linux', 'arch'=>'x86-64', 'dirname'=>'linux_x86_64-glibc2.3.4', 'us1-dir'=>'linux/x86_64');
$platforms[] = array('os'=>'lin','os_human'=>'Linux', 'arch'=>'ppc', 'dirname'=>'linux_ppc-glibc2.3.4','us1-dir'=>'linux/ppc');
$platforms[] = array('os'=>'lin','os_human'=>'Linux', 'arch'=>'ppc64', 'dirname'=>'linux_ppc64-glibc2.5','us1-dir'=>'linux/ppc64');
$platforms[] = array('os'=>'dra', 'os_human'=>'DragonFly', 'arch'=>'x86', 'dirname'=>'dragonfly_i386-1.7', 'us1-dir'=>'Dragonfly/x86');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 4', 'os_mod'=>'_4', 'arch'=>'x86', 'dirname'=>'freebsd_i386-4.8', 'us1-dir'=>'FreeBSD/v4');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 6', 'os_mod'=>'_6', 'arch'=>'x86', 'dirname'=>'freebsd_i386-6.2', 'us1-dir'=>'FreeBSD/v6/x86');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 6', 'os_mod'=>'_6', 'arch'=>'x86-64', 'dirname'=>'freebsd_amd64-6.2', 'us1-dir'=>'FreeBSD/v6/AMD64');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 7', 'os_mod'=>'_7', 'arch'=>'x86', 'dirname'=>'freebsd_i386-7.3', 'us1-dir'=>'FreeBSD/v7/x86');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 7', 'os_mod'=>'_7', 'arch'=>'x86-64', 'dirname'=>'freebsd_amd64-7.3', 'us1-dir'=>'FreeBSD/v7/AMD64');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 8', 'os_mod'=>'_8', 'arch'=>'x86', 'dirname'=>'freebsd_i386-8.0', 'us1-dir'=>'FreeBSD/v8/x86');
$platforms[] = array('os'=>'fre', 'os_human'=>'FreeBSD 8', 'os_mod'=>'_8', 'arch'=>'x86-64', 'dirname'=>'freebsd_amd64-8.0', 'us1-dir'=>'FreeBSD/v8/AMD64');
$platforms[] = array('os'=>'bsd', 'os_human'=>'BSDi', 'is_legacy' => 1, 'arch'=>'x86', 'dirname'=>'bsdi_i386-4.3.1');
$platforms[] = array('os'=>'net', 'os_human'=>'NetBSD', 'arch'=>'x86', 'dirname'=>'netbsd_i386-2.1','us1-dir'=>'NetBSD/x86');
$platforms[] = array('os'=>'net', 'os_human'=>'NetBSD', 'arch'=>'x86-64', 'dirname'=>'netbsd_amd64-2.0','us1-dir'=>'NetBSD/x86_64');
$platforms[] = array('os'=>'ope', 'os_human'=>'OpenBSD 4.2', 'os_mod'=>'_4.2', 'arch'=>'x86', 'dirname'=>'openbsd_i386-4.2', 'us1-dir'=>'OpenBSD/x86');
$platforms[] = array('os'=>'ope', 'os_human'=>'OpenBSD 4.5', 'os_mod'=>'_4.5', 'arch'=>'x86', 'dirname'=>'openbsd_i386-4.5', 'us1-dir'=>'OpenBSD/x86');
$platforms[] = array('os'=>'ope', 'os_human'=>'OpenBSD 4.6', 'os_mod'=>'_4.6', 'arch'=>'x86', 'dirname'=>'openbsd_i386-4.6', 'us1-dir'=>'OpenBSD/x86');
$platforms[] = array('os'=>'ope', 'os_human'=>'OpenBSD 4.7', 'os_mod'=>'_4.7', 'arch'=>'x86-64', 'dirname'=>'openbsd_amd64-4.7', 'us1-dir' => 'OpenBSD/x86_64');
$platforms[] = array('os'=>'dar', 'os_human'=>'OS X', 'is_legacy' => 1, 'arch'=>'ppc', 'dirname'=>'osx_powerpc-8.5','us1-dir'=>'OSX/ppc');
$platforms[] = array('os'=>'dar', 'os_human'=>'OS X', 'arch'=>'x86', 'dirname'=>'osx_i386-8.11','us1-dir'=>'OSX/x86');
$platforms[] = array('os'=>'dar', 'os_human'=>'OS X', 'arch'=>'x86-64', 'dirname'=>'osx_x86-64-10.2','us1-dir'=>'OSX/x86_64');
$platforms[] = array('os'=>'sun', 'os_human'=>'Solaris', 'is_legacy' => 1, 'arch'=>'sparc', 'dirname'=>'solaris_sparc-5.9', 'us1-dir'=>'Solaris/sparc');
$platforms[] = array('os'=>'sun', 'os_human'=>'Solaris', 'arch'=>'x86', 'dirname'=>'solaris_i386-5.10','us1-dir'=>'Solaris/x86');
return $platforms;
}
function get_loader_platforms()
{
return get_remote_session_value('loader_platform_info',LOADER_PLATFORM_URL,'default_platform_list');
}
function get_platforminfo()
{
static $platforminfo;
if (empty($platforminfo)) {
$platforminfo = get_loader_platforms();
}
return $platforminfo;
}
function default_php_versions()
{
return array();
}
function get_php_versions()
{
return get_remote_session_value('php_version_info',LOADER_PHP_VERSION_URL,'default_php_versions');
}
function get_max_php_version_supported()
{
static $max_php_version;
if (empty($max_php_version)) {
$php_versions = get_php_versions();
$dirname = calc_dirname();
if (array_key_exists($dirname,$php_versions)) {
$max_php_version = $php_versions[$dirname];
} else {
$max_php_version = NULL;
}
}
return $max_php_version;
}
function is_after_max_php_version_supported()
{
$is_too_recent_php = false;
$supported_php_version = get_max_php_version_supported();
if (!is_null($supported_php_version)) {
$pversion = php_version();
$supported_parts = explode('.',$supported_php_version);
$is_too_recent_php = ($supported_parts[0] < $pversion['major'] || ($supported_parts[0] == $pversion['major'] && $supported_parts[1] < $pversion['minor']));
}
if ($is_too_recent_php) {
return $supported_php_version;
} else {
return false;
}
}
function supported_os_variants($os_code,$arch_code)
{
if (empty($os_code)) {
return ERROR_UNKNOWN_OS;
}
if (empty($arch_code)) {
return ERROR_UNKNOWN_ARCH;
}
$os_found = false;
$arch_found = false;
$os_arch_matches = array();
$pinfo = get_platforminfo();
foreach ($pinfo as $p) {
if ($p['os'] == $os_code && $p['arch'] == $arch_code) {
$os_arch_matches[$p['os_human']] = (isset($p['os_mod']))?(0 + (int) str_replace('_','',$p['os_mod'])):'';
}
if ($p['os'] == $os_code) {
$os_found = true;
} elseif ($p['arch'] == $arch_code) {
$arch_found = true;
}
}
if (!empty($os_arch_matches)) {
asort($os_arch_matches);
return $os_arch_matches;
} elseif (!$os_found) {
return ERROR_UNSUPPORTED_OS;
} elseif (!$arch_found) {
return ERROR_UNSUPPORTED_ARCH;
} else {
return ERROR_UNSUPPORTED_ARCH_OS;
}
}
function default_win_compilers()
{
return array('VC6','VC9','VC11','VC14','VC15');
}
function supported_win_compilers()
{
static $win_compilers;
if (empty($win_compilers)) {
$win_compilers = find_win_compilers();
}
return $win_compilers;
}
function find_win_compilers()
{
return get_remote_session_value('php_compilers_info',PHP_COMPILERS_URL,'default_win_compilers');
}
function server_software_info()
{
$ss = array('full' => '','short' => '');
$ss['full'] = $_SERVER['SERVER_SOFTWARE'];
if (preg_match('/apache/i', $ss['full'])) {
$ss['short'] = 'Apache';
} else if (preg_match('/IIS/',$ss['full'])) {
$ss['short'] = 'IIS';
} else {
$ss['short'] = '';
}
return $ss;
}
function match_arch_pattern($str)
{
$arch = null;
$arch_patterns = array(
'i.?86' => 'x86',
'x86[-_]64' => 'x86',
'x86' => 'x86',
'amd64' => 'x86',
'SMP Tue Jan 01 00:00:00 CEST 2000 all GNU\/Linux' => 'x86',
'ppc64' => 'ppc',
'ppc' => 'ppc',
'powerpc' => 'ppc',
'sparc' => 'sparc',
'sun' => 'sparc',
'armv7l' => 'armv7l',
'aarch64' => 'aarch64'
);
foreach ($arch_patterns as $token => $a) {
if (preg_match("/$token/i", $str)) {
$arch = $a;
break;
}
}
return $arch;
}
function required_loader_arch($mach_info,$os_code,$wordsize)
{
if ($os_code == 'win') {
$arch = ($wordsize == 32)?'x86':'x86-64';
} elseif (!empty($os_code)) {
$arch = match_arch_pattern($mach_info);
if ($wordsize == 64) {
if ($arch == 'x86') {
$arch = 'x86-64';
} elseif ($arch == 'ppc') {
$arch = 'ppc64';
}
}
} else {
$arch = ERROR_UNKNOWN_ARCH;
}
return $arch;
}
function uname($part = 'a')
{
$result = '';
if (!function_is_disabled('php_uname')) {
$result = @php_uname($part);
} elseif (function_exists('posix_uname') && !function_is_disabled('posix_uname')) {
$posix_equivs = array(
'm' => 'machine',
'n' => 'nodename',
'r' => 'release',
's' => 'sysname'
);
$puname = @posix_uname();
if ($part == 'a' || !array_key_exists($part,$posix_equivs)) {
$result = join(' ',$puname);
} else {
$result = $puname[$posix_equivs[$part]];
}
} else {
if (!function_is_disabled('phpinfo')) {
ob_start();
phpinfo(INFO_GENERAL);
$pinfo = ob_get_contents();
ob_end_clean();
if (preg_match('~System.*?(</B></td><TD ALIGN="left">| => |v">)([^<]*)~i',$pinfo,$match)) {
$uname = $match[2];
if ($part == 'r') {
if (!empty($uname) && preg_match('/\S+\s+\S+\s+([0-9.]+)/',$uname,$matchver)) {
$result = $matchver[1];
} else {
$result = '';
}
} else {
$result = $uname;
}
}
} else {
$result = '';
}
}
return $result;
}
function calc_word_size($os_code)
{
$wordsize = null;
if ('win' === $os_code) {
ob_start();
phpinfo(INFO_GENERAL);
$pinfo = ob_get_contents();
ob_end_clean();
if (preg_match('~Compiler.*?(</B></td><TD ALIGN="left">| => |v">)([^<]*)~i',$pinfo,$compmatch)) {
if (preg_match("/(VC[0-9]+)/i",$compmatch[2],$vcmatch)) {
$compiler = strtoupper($vcmatch[1]);
} else {
$compiler = 'VC6';
}
} else {
$compiler = 'VC6';
}
if ($compiler === 'VC9' || $compiler === 'VC11' || $compiler === 'VC14' || $compiler === 'VC15') {
if (preg_match('~Architecture.*?(</B></td><TD ALIGN="left">| => |v">)([^<]*)~i',$pinfo,$archmatch)) {
if (preg_match("/x64/i",$archmatch[2])) {
$wordsize = 64;
} else {
$wordsize = 32;
}
} elseif (isset($_ENV['PROCESSOR_ARCHITECTURE']) && preg_match('~(amd64|x86-64|x86_64)~i',$_ENV['PROCESSOR_ARCHITECTURE'])) {
if (preg_match('~Configure Command.*?(</B></td><TD ALIGN="left">| => |v">)([^<]*)~i',$pinfo,$confmatch)) {
if (preg_match('~(x64|lib64|system64)~i',$confmatch[2])) {
$wordsize = 64;
}
}
} else {
$wordsize = 32;
}
}
}
if (empty($wordsize)) {
$wordsize = ((-1^0xffffffff)?64:32);
}
return $wordsize;
}
function required_loader($unamestr = '')
{
$un = empty($unamestr)?uname():$unamestr;
$php_major_version = substr(PHP_VERSION,0,3);
$os_name = substr($un,0,strpos($un,' '));
$os_code = empty($os_name)?'':strtolower(substr($os_name,0,3));
$wordsize = calc_word_size($os_code);
if ($os_code == 'win' && $wordsize == 64 && $php_major_version < '5.5') {
$arch = ERROR_WINDOWS_64_BIT;
} else {
$arch = required_loader_arch($un,$os_code,$wordsize);
}
if (!is_string($arch)) {
return $arch;
}
$os_variants = supported_os_variants($os_code,$arch);
if (!is_array($os_variants)) {
return $os_variants;
}
$os_ver = '';
if (preg_match('/([0-9.]+)/',uname('r'),$match)) {
$os_ver = $match[1];
}
$os_ver_parts = preg_split('@\.@',$os_ver);
$os_code_h = ($os_code == 'dar' ? 'mac' : $os_code);
$loader_sfix = (($os_code == 'win') ? 'dll' : 'so');
$file = "ioncube_loader_${os_code_h}_${php_major_version}.${loader_sfix}";
if ($os_code == 'win') {
$os_name = 'Windows';
$file_ts = $file;
$os_name_qual = 'Windows';
} else {
$os_names = array_keys($os_variants);
if (count($os_variants) > 1) {
$parts = explode(" ",$os_names[0]);
$os_name = $parts[0];
$os_name_qual = $os_name . ' ' . $os_ver_parts[0] . '.' . $os_ver_parts[1];
} else {
$os_name = $os_names[0];
$os_name_qual = $os_name;
}
$file_ts = "ioncube_loader_${os_code_h}_${php_major_version}_ts.${loader_sfix}";
}
return array(
'uname' => $un,
'arch' => $arch,
'oscode' => $os_code,
'oscode_h' => $os_code_h,
'osname' => $os_name,
'osnamequal' => $os_name_qual,
'osvariants' => $os_variants,
'osver' => $os_ver,
'osver2' => $os_ver_parts,
'file' => $file,
'file_ts' => $file_ts,
'wordsize' => $wordsize
);
}
function ic_system_info()
{
$thread_safe = null;
$debug_build = null;
$cgi_cli = false;
$is_fpm = false;
$is_cgi = false;
$is_cli = false;
$php_ini_path = '';
$php_ini_dir = '';
$php_ini_add = '';
$is_supported_compiler = true;
$php_compiler = is_ms_windows()?'VC6':'';
ob_start();
phpinfo(INFO_GENERAL);
$php_info = ob_get_contents();
ob_end_clean();
$breaker = (php_sapi_name() == 'cli')?"\n":'</tr>';
$lines = explode($breaker,$php_info);
foreach ($lines as $line) {
if (preg_match('/command/i',$line)) {
continue;
}
if (preg_match('/thread safety/i', $line)) {
$thread_safe = (preg_match('/(enabled|yes)/i', $line) != 0);
}
if (preg_match('/debug build/i', $line)) {
$debug_build = (preg_match('/(enabled|yes)/i', $line) != 0);
}
if (preg_match('~configuration file.*(</B></td><TD ALIGN="left">| => |v">)([^ <]*)~i',$line,$match)) {
$php_ini_path = $match[2];
if (!@file_exists($php_ini_path)) {
$php_ini_path = '';
}
}
if (preg_match('~dir for additional \.ini files.*(</B></td><TD ALIGN="left">| => |v">)([^ <]*)~i',$line,$match)) {
$php_ini_dir = $match[2];
if (!@file_exists($php_ini_dir)) {
$php_ini_dir = '';
}
}
if (preg_match('~additional \.ini files parsed.*(</B></td><TD ALIGN="left">| => |v">)([^ <]*)~i',$line,$match)) {
$php_ini_add = $match[2];
}
if (preg_match('/compiler/i',$line)) {
$supported_match = join('|',supported_win_compilers());
$is_supported_compiler = preg_match("/($supported_match)/i",$line);
if (preg_match("/(VC[0-9]+)/i",$line,$match)) {
$php_compiler = strtoupper($match[1]);
} elseif (preg_match("/Visual C\+\+ 2017/i",$line)) {
$php_compiler = "VC15";
$is_supported_compiler = true;
} else {
$php_compiler = '';
}
}
}
$is_cgi = strpos(php_sapi_name(),'cgi') !== false;
$is_cli = strpos(php_sapi_name(),'cli') !== false;
$is_fpm = strpos(php_sapi_name(),'fpm-fcgi') !== false;
$cgi_cli = $is_cgi || $is_cli;
$ss = server_software_info();
if ($is_fpm) {
$ss['short'] = 'PHP-FPM';
$ss['full'] = 'PHP-FPM ' . $ss['full'];
}
if (!$php_ini_path && function_exists('php_ini_loaded_file')) {
$php_ini_path = php_ini_loaded_file();
if ($php_ini_path === false) {
$php_ini_path = '';
}
}
if (!empty($php_ini_path)) {
$real_path = @realpath($php_ini_path);
if (false !== $real_path) {
$php_ini_path = $real_path;
}
}
$php_ini_basename = basename($php_ini_path);
return array(
'THREAD_SAFE' => $thread_safe,
'DEBUG_BUILD' => $debug_build,
'PHP_INI' => $php_ini_path,
'PHP_INI_BASENAME' => $php_ini_basename,
'PHP_INI_DIR' => $php_ini_dir,
'PHP_INI_ADDITIONAL' => $php_ini_add,
'PHPRC' => getenv('PHPRC'),
'CGI_CLI' => $cgi_cli,
'IS_CGI' => $is_cgi,
'IS_CLI' => $is_cli,
'IS_FPM' => $is_fpm,
'PHP_COMPILER' => $php_compiler,
'SUPPORTED_COMPILER' => $is_supported_compiler,
'FULL_SS' => $ss['full'],
'SS' => $ss['short']);
}
function is_possibly_dedicated_or_local()
{
$sys = get_sysinfo();
return (empty($sys['PHP_INI']) || !@file_exists($sys['PHP_INI']) || (is_readable($sys['PHP_INI']) && (0 !== strpos($sys['PHP_INI'],$_SERVER['DOCUMENT_ROOT']))));
}
function is_local()
{
$ret = false;
if ($_SERVER["SERVER_NAME"] == 'localhost') {
$ret = true;
} else {
$ip_address = strtolower($_SERVER["REMOTE_ADDR"]);
if (strpos(':',$ip_address) === false) {
$ip_parts = explode('.',$ip_address);
$ret = (($ip_parts[0] == 10) ||
($ip_parts[0] == 172 && $ip_parts[1] >= 16 && $ip_parts[1] <= 31) ||
($ip_parts[0] == 192 && $ip_parts[1] == 168));
} else {
$ret = ($ip_address == '::1') || (($ip_address[0] == 'f') && ($ip_address[1] >= 'c' && $ip_address[1] <= 'f'));
}
}
return $ret;
}
function is_shared()
{
return !is_local() && !is_possibly_dedicated_or_local();
}
function find_server_type($chosen_type = '',$type_must_be_chosen = false,$set_session = false)
{
$server_type = SERVER_UNKNOWN;
if (empty($chosen_type)) {
if ($type_must_be_chosen) {
$server_type = SERVER_UNKNOWN;
} else {
if (isset($_SESSION['server_type']) && $_SESSION['server_type'] != SERVER_UNKNOWN) {
$server_type = $_SESSION['server_type'];
} elseif (is_local()) {
$server_type = SERVER_LOCAL;
} elseif (!is_possibly_dedicated_or_local()) {
$server_type = SERVER_SHARED;
} else {
$server_type = SERVER_UNKNOWN;
}
}
} else {
switch ($chosen_type) {
case 's':
$server_type = SERVER_SHARED;
break;
case 'd':
$server_type = SERVER_DEDICATED;
break;
case 'l':
$server_type = SERVER_LOCAL;
break;
default:
$server_type = SERVER_UNKNOWN;
break;
}
}
if ($set_session) {
$_SESSION['server_type'] = $server_type;
}
return $server_type;
}
function server_type_string()
{
$server_code = find_server_type();
switch ($server_code) {
case SERVER_SHARED:
$server_string = 'SHARED';
break;
case SERVER_LOCAL:
$server_string = 'LOCAL';
break;
case SERVER_DEDICATED:
$server_string = 'DEDICATED';
break;
default:
$server_string = 'UNKNOWN';
break;
}
return $server_string;
}
function server_type_code()
{
$server_code = find_server_type();
switch ($server_code) {
case SERVER_SHARED:
$server_char = 's';
break;
case SERVER_LOCAL:
$server_char = 'l';
break;
case SERVER_DEDICATED:
$server_char = 'd';
break;
default:
$server_char = '';
break;
}
return $server_char;
}
function get_sysinfo()
{
static $sysinfo;
if (empty($sysinfo)) {
$sysinfo = ic_system_info();
}
return $sysinfo;
}
function get_loaderinfo()
{
static $loader;
if (empty($loader)) {
$loader = required_loader();
}
return $loader;
}
function is_ms_windows()
{
$loader_info = get_loaderinfo();
return ($loader_info['oscode'] == 'win');
}
function function_is_disabled($fn_name)
{
$disabled_functions=explode(',',ini_get('disable_functions'));
return in_array($fn_name, $disabled_functions);
}
function selinux_is_enabled()
{
$se_enabled = false;
if (!is_ms_windows()) {
$cmd = @shell_exec('sestatus');
$se_enabled = preg_match('/enabled/i',$cmd);
}
return $se_enabled;
}
function grsecurity_is_enabled()
{
$gr_enabled = false;
if (!is_ms_windows()) {
$cmd = @shell_exec('gradm -S');
$gr_enabled = preg_match('/enabled/i',$cmd);
}
return $gr_enabled;
}
function threaded_and_not_cgi()
{
$sys = get_sysinfo();
return($sys['THREAD_SAFE'] && !$sys['IS_CGI']);
}
function is_restricted_server($only_safe_mode = false)
{
$disable_functions = ini_get('disable_functions');
$open_basedir = ini_get('open_basedir');
$php_restrictions = !empty($disable_functions) || !empty($open_basedir);
$system_restrictions = selinux_is_enabled() || grsecurity_is_enabled();
$non_safe_mode_restrictions = $php_restrictions || $system_restrictions;
return (ini_get('safe_mode') || (!$only_safe_mode && $non_safe_mode_restrictions));
}
function server_restriction_warnings()
{
$warnings = array();
if (find_server_type() == SERVER_SHARED) {
if (is_restricted_server()) {
$warnings[] = "Server restrictions are in place which might affect the operation of this Loader Wizard or prevent the installation of the Loader.";
}
} else {
$warning_suffix = "This may affect the operation of this Loader Wizard.";
if (ini_get('safe_mode')) {
$warnings[] = "Safe mode is in effect on the server. " . $warning_suffix;
}
$disabled_functions = ini_get('disable_functions');
if (!empty($disabled_functions)) {
$warnings[] = "Some functions are disabled through disable_functions. " . $warning_suffix;
}
$open_basedir = ini_get('open_basedir');
if (!empty($open_basedir)) {
$warnings[] = "Open basedir restrictions are in effect. " . $warning_suffix;
}
}
return $warnings;
}
function own_php_ini_possible($only_safe_mode = false)
{
$sysinfo = get_sysinfo();
return ($sysinfo['CGI_CLI'] && !is_ms_windows() && !is_restricted_server($only_safe_mode));
}
function extension_dir()
{
$extdir = ini_get('extension_dir');
if ($extdir == './' || ($extdir == '.\\' && is_ms_windows())) {
$extdir = '.';
}
return $extdir;
}
function possibly_selinux()
{
$loaderinfo = get_loaderinfo();
$se_env = (getenv("SELINUX_INIT"));
return (strtolower($loaderinfo['osname']) == 'linux' && $se_env && ($se_env == 'Yes' || $se_env == '1'));
}
function ini_same_dir_as_wizard()
{
$sys = get_sysinfo();
return dirname($sys['PHP_INI']) == dirname(__FILE__);
}
function extension_dir_path()
{
$ext_dir = extension_dir();
if ($ext_dir == '.' || (dirname($ext_dir) == '.')) {
$ext_dir_path = @realpath($ext_dir);
} else {
$ext_dir_path = $ext_dir;
}
return $ext_dir_path;
}
function get_loader_name()
{
$u = uname();
$sys = get_sysinfo();
$os = substr($u,0,strpos($u,' '));
$os_code = strtolower(substr($u,0,3));
$os_code_h = ($os_code == 'dar' ? 'mac' : $os_code);
$php_version = phpversion();
$php_family = substr($php_version,0,3);
$loader_sfix = (($os_code == 'win') ? '.dll' : (($sys['THREAD_SAFE'])?'_ts.so':'.so'));
$loader_name="ioncube_loader_${os_code_h}_${php_family}${loader_sfix}";
return $loader_name;
}
function get_reqd_version($variants)
{
$exact_match = false;
$nearest_version = 0;
$loader_info = get_loaderinfo();
$os_version = $loader_info['osver2'][0] . '.' . $loader_info['osver2'][1];
$os_version_major = $loader_info['osver2'][0];
foreach ($variants as $v) {
if ($v == $os_version || (is_int($v) && $v == $os_version_major)) {
$exact_match = true;
$nearest_version = $v;
break;
} elseif ($v > $os_version) {
break;
} else {
$nearest_version = $v;
}
}
return (array($nearest_version,$exact_match));
}
function get_default_loader_dir_webspace()
{
return ($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . LOADER_SUBDIR);
}
function get_loader_location($loader_dir = '')
{
if (empty($loader_dir)) {
$loader_dir = get_default_loader_dir_webspace();
}
$loader_name = get_loader_name();
return ($loader_dir . DIRECTORY_SEPARATOR . $loader_name);
}
function get_loader_location_from_ini($php_ini = '')
{
$errors = array();
if (empty($php_ini)) {
$sysinfo = get_sysinfo();
$php_ini = $sysinfo['PHP_INI'];
}
if (!@file_exists($php_ini)) {
if (empty($php_ini)) {
$errors[ERROR_INI_NOT_FOUND] = "The configuration file could not be found.";
} else {
$errors[ERROR_INI_NOT_FOUND] = "The $php_ini file could not be found.";
}
} elseif (!is_readable($php_ini)) {
$errors[ERROR_INI_NOT_READABLE] = "The $php_ini file could not be read.";
}
if (!empty($errors)) {
return array('location' => '', 'errors' => $errors);
}
$lines = file($php_ini);
$ext_start = zend_extension_line_start();
$wrong_ext_start = ($ext_start == 'zend_extension')?'zend_extension_ts':'zend_extension';
$loader_path = '';
$loader_name_match = "ioncube_loader";
foreach ($lines as $l) {
if (preg_match("/^\s*$ext_start\s*=\s*\"?([^\"]+)\"?/i",$l,$corr_matches)) {
if (preg_match("/$loader_name_match/i",$corr_matches[1])) {
if (!empty($loader_path)) {
$errors[ERROR_INI_MULTIPLE_IC_LOADER_LINES] = "It appears that multiple $ext_start lines for the ionCube Loader have been included in the configuration file, $php_ini.";
}
$loader_path = $corr_matches[1];
} else {
if (empty($loader_path)) {
$errors[ERROR_INI_NOT_FIRST_ZE] = "The ionCube Loader must be the first Zend extension listed in the configuration file, $php_ini.";
}
}
}
if (empty($loader_path)) {
if (preg_match("/^\s*$wrong_ext_start\s*=\s*\"?([^\"]+)\"?/i",$l,$bad_start_matches)) {
if (preg_match("/$loader_name_match/i",$bad_start_matches[1])) {
$bad_zend_ext_msg = "The line for the ionCube Loader in the configuration file, $php_ini, should start with $ext_start and <b>not</b> $wrong_ext_start.";
$errors[ERROR_INI_WRONG_ZE_START] = $bad_zend_ext_msg;
$loader_path = $bad_start_matches[1];
}
}
}
}
$loader_path = trim($loader_path);
if ($loader_path === '') {
$errors[ERROR_INI_ZE_LINE_NOT_FOUND] = "The necessary zend_extension line could not be found in the configuration file, $php_ini.";
} elseif (!@file_exists($loader_path)) {
$errors[ERROR_INI_LOADER_FILE_NOT_FOUND] = "The loader file $loader_path, listed in the configuration file, $php_ini, does not exist or is not accessible.";
} elseif (basename($loader_path) == $loader_path) {
$errors[ERROR_INI_NOT_FULL_PATH] = "A full path must be specified for the loader file in the configuration file, $php_ini.";
}
return array('location' => $loader_path, 'errors' => $errors);
}
function zend_extension_line_missing($ini_path)
{
$loader_loc = get_loader_location_from_ini($ini_path);
return (!empty($loader_loc['errors']) && array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND,$loader_loc['errors']));
}
function find_additional_ioncube_ini()
{
$sys = get_sysinfo();
$ioncube_ini = '';
if (!empty($sys['PHP_INI_ADDITIONAL']) && !preg_match('/(none)/i',$sys['PHP_INI_ADDITIONAL'])) {
$ini_files = explode(',',$sys['PHP_INI_ADDITIONAL']);
foreach ($ini_files as $f) {
$fn = trim($f);
$bfn = basename($fn);
if (preg_match('/ioncube/i',$bfn)) {
$ioncube_ini = $fn;
break;
}
}
}
return $ioncube_ini;
}
function get_additional_ini_files()
{
$sys = get_sysinfo();
$ini_files = array();
if (!empty($sys['PHP_INI_ADDITIONAL']) && !preg_match('/(none)/i',$sys['PHP_INI_ADDITIONAL'])) {
$ini_files = explode(',',$sys['PHP_INI_ADDITIONAL']);
}
return (array_map('trim',$ini_files));
}
function all_ini_contents()
{
$sys = get_sysinfo();
$output = '';
$output .= ";;; *MAIN INI FILE AT ${sys['PHP_INI']}* ;;;" . PHP_EOL;
$output .= get_file_contents($sys['PHP_INI']);
$other_inis = get_additional_ini_files();
foreach ($other_inis as $inif) {
$output .= ";;; *Additional ini file at $inif* ;;;" . PHP_EOL;
$output .= get_file_contents($inif);
}
$here = unix_path_dir();
$unrec_ini_files = unrecognised_inis_webspace($here);
foreach ($unrec_ini_files as $urinif) {
$output .= ";;; *UNRECOGNISED INI FILE at $urinif* ;;;" . PHP_EOL;
$output .= get_file_contents($urinif);
}
return $output;
}
function scan_inis_for_loader()
{
$ldloc = array('location' => '', 'errors' => array());
$sysinfo = get_sysinfo();
if (empty($sysinfo['PHP_INI'])) {
$ini_files_not_found = array("Main ini file");
$ini_file_list = get_additional_ini_files();
} else {
$ini_files_not_found = array();
$ini_file_list = array_merge(array($sysinfo['PHP_INI']),get_additional_ini_files());
}
$server_type = find_server_type();
$shared_server = SERVER_SHARED == $server_type;
foreach ($ini_file_list as $f) {
$ldloc = get_loader_location_from_ini($f);
if (array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND,$ldloc['errors'])) {
unset($ldloc['errors'][ERROR_INI_ZE_LINE_NOT_FOUND]);
}
if ($shared_server && array_key_exists(ERROR_INI_NOT_FOUND,$ldloc['errors'])) {
if (false == user_ini_space_path($f)) {
$ldloc['errors'][ERROR_INI_NOT_FOUND] = "A system ini file cannot be found or read by the Wizard - you cannot do anything about this on your shared server.";
} else {
$ldloc['errors'][ERROR_INI_USER_INI_NOT_FOUND] = $ldloc['errors'][ERROR_INI_NOT_FOUND];
}
} elseif (array_key_exists(ERROR_INI_NOT_FOUND,$ldloc['errors'])) {
$ini_files_not_found[] = $f;
}
if (!empty($ldloc['location'])) {
break;
}
}
if (!empty($ini_files_not_found)) {
$plural = (count($ini_files_not_found) > 1)?"s":"";
$ldloc['errors'][ERROR_INI_NOT_FOUND] = "The following ini file$plural could not be found by the Wizard: " . join(',',$ini_files_not_found);
if (is_restricted_server()) {
$ldloc['errors'][ERROR_INI_NOT_FOUND] .= "<br> This may be due to server restrictions in place.";
}
}
if (empty($ldloc['location'])) {
$ldloc['errors'][ERROR_INI_ZE_LINE_NOT_FOUND] = "The necessary zend_extension line could not be found in the configuration.";
}
return $ldloc;
}
function find_loader_filesystem()
{
$ld_inst_dir = loader_install_dir(find_server_type());
$loader_name = get_loader_name();
$suggested_loader_path = $ld_inst_dir . DIRECTORY_SEPARATOR . $loader_name;
if (@file_exists($suggested_loader_path)) {
$location = $suggested_loader_path;
} elseif (@file_exists($loader_name)) {
$location = @realpath($loader_name);
} else {
$ld_loc = get_loader_location();
if (@file_exists($ld_loc)) {
$location = $ld_loc;
} else {
$location = '';
}
}
return $location;
}
function find_loader($search_directories_if_not_ini = false)
{
$sysinfo = get_sysinfo();
$php_ini = $sysinfo['PHP_INI'];
$rtl_path = get_runtime_loading_path_if_applicable();
$location = '';
$errors = array();
if (!empty($rtl_path)) {
$location = $rtl_path;
} else {
$loader_ini = scan_inis_for_loader();
$location = $loader_ini['location'];
$errors = $loader_ini['errors'];
}
if (empty($location) && (empty($errors) || $search_directories_if_not_ini)) {
$errors = array();
$location = find_loader_filesystem();
if (empty($location)) {
$errors[ERROR_LOADER_NOT_FOUND] = 'The loader file could not be found in standard locations.';
}
}
if (!empty($errors)) {
return $errors;
} else {
return $location;
}
}
function zend_extension_line_start()
{
$sysinfo = get_sysinfo();
$is_53_or_later = is_php_version_or_greater(5,3);
return (is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'] && !$is_53_or_later ? 'zend_extension_ts' : 'zend_extension');
}
function ioncube_loader_version_information()
{
$old_version = true;
$liv = "";
$lv = "";
$mv = 0;
if (function_exists('ioncube_loader_iversion')) {
$liv = ioncube_loader_iversion();
$lv = sprintf("%d.%d.%d", $liv / 10000, ($liv / 100) % 100, $liv % 100);
$latest_version = get_latestversion();
$lat_parts = explode('.',$latest_version);
$cur_parts = explode('.',$lv);
if (($cur_parts[0] > $lat_parts[0]) ||
($cur_parts[0] == $lat_parts[0] && $cur_parts[1] > $lat_parts[1]) ||
($cur_parts[0] == $lat_parts[0] && $cur_parts[1] == $lat_parts[1] && $cur_parts[2] >= $lat_parts[2])) {
$old_version = false;
} else {
$old_version = $latest_version;
}
$mv = $cur_parts[0];
}
return array($lv,$mv,$old_version);
}
function default_loader_version_info()
{
return array();
}
function get_loader_version_info()
{
return get_remote_session_value('loader_version_info',LOADER_LATEST_VERSIONS_URL,'default_loader_version_info');
}
function calc_platform()
{
$platform = array();
$platform_info = get_platforminfo();
$loader = get_loaderinfo();
$multiple_os_versions = false;
if (is_array($loader) && array_key_exists('osvariants',$loader) && is_array($loader['osvariants'])) {
$versions = array_values($loader['osvariants']);
$multiple_os_versions = !empty($versions[0]);
}
if ($multiple_os_versions) {
list($osvar,$exact_match) = get_reqd_version($loader['osvariants']);
} else {
$osvar = null;
if (is_ms_windows()) {
$sys = get_sysinfo();
$phpc = (empty($sys['PHP_COMPILER']))?'vc6':strtolower($sys['PHP_COMPILER']);
$osvar = ($sys['THREAD_SAFE']?'':'nonts_') . $phpc;
}
}
foreach ($platform_info as $p) {
if ($p['os'] == $loader['oscode'] && $p['arch'] == $loader['arch'] && (empty($osvar) || $p['os_mod'] == "_" . $osvar)) {
$platform = $p;
break;
}
}
return $platform;
}
function get_platform()
{
static $this_platform;
if (!isset($this_platform)) {
$this_platform = calc_platform();
}
return $this_platform;
}
function is_legacy_platform()
{
$platform = get_platform();
return array_key_exists('is_legacy',$platform);
}
function calc_dirname()
{
$dirname = '';
$platform = get_platform();
if (!empty($platform)) {
$dirname = $platform['dirname'];
}
return $dirname;
}
function calc_loader_latest_version()
{
$lv_info = get_loader_version_info();
$latest_version = RECENT_LOADER_VERSION;
if (!empty($lv_info)) {
$dirname = calc_dirname();
if (!empty($dirname)) {
$compiler_specific_version = false;
if (is_ms_windows()) {
$sys = get_sysinfo();
$phpc = strtolower($sys['PHP_COMPILER']);
if (!empty($phpc)) {
$dirname_comp = $dirname . "_" . $phpc;
if (array_key_exists($dirname_comp,$lv_info)) {
$latest_version = $lv_info[$dirname_comp];
$compiler_specific_version = true;
}
}
}
if (!$compiler_specific_version && array_key_exists($dirname,$lv_info)) {
$latest_version = $lv_info[$dirname];
}
}
}
return $latest_version;
}
function get_latestversion()
{
static $latest_version;
if (empty($latest_version)) {
$latest_version = calc_loader_latest_version();
}
return $latest_version;
}
function runtime_loader_location()
{
$loader_path = false;
$ext_path = extension_dir_path();
if ($ext_path !== false) {
$id = $ext_path;
$here = dirname(__FILE__);
if (isset($id[1]) && $id[1] == ':') {
$id = str_replace('\\','/',substr($id,2));
$here = str_replace('\\','/',substr($here,2));
}
$rd=str_repeat('/..',substr_count($id,'/')).$here.'/';
$i=strlen($rd);
$loader_loc = DIRECTORY_SEPARATOR . basename($here) . DIRECTORY_SEPARATOR . get_loader_name();
while($i--) {
if($rd[$i]=='/') {
$loader_path = runtime_location_exists($ext_path,$rd,$i,$loader_loc);
if ($loader_path !== false) {
break;
}
}
}
if (!$loader_path && !empty($loader_loc) && @file_exists($loader_loc)) {
$loader_path = basename($loader_loc);
}
}
return $loader_path;
}
function runtime_location_exists($ext_dir,$path_str,$sep_pos,$loc_name)
{
$sub_path = substr($path_str,0,$sep_pos);
$lp = $sub_path . $loc_name;
$fqlp = $ext_dir.$lp;
if(@file_exists($fqlp)) {
return $lp;
} else {
return false;
}
}
function runtime_loading_is_possible() {
return !((is_php_version_or_greater(5,2,5)) || is_restricted_server() || !ini_get('enable_dl') || !function_exists('dl') || function_is_disabled('dl') || threaded_and_not_cgi());
}
function shared_and_runtime_loading()
{
return (find_server_type() == SERVER_SHARED && empty($_SESSION['use_ini_method']) && runtime_loading_is_possible());
}
function get_valid_runtime_loading_path($ignore_loading_check = false)
{
if ($ignore_loading_check || runtime_loading_is_possible()) {
return runtime_loader_location();
} else {
return false;
}
}
function runtime_loading($rtl_path = null)
{
if (empty($rtl_path)) {
$rtl_path = get_valid_runtime_loading_path();
}
if (!empty($rtl_path) && @dl($rtl_path)) {
return $rtl_path;
} else {
return false;
}
}
function get_runtime_loading_path_if_applicable()
{
$rtl = null;
if (shared_and_runtime_loading()) {
$rtl = get_valid_runtime_loading_path();
}
return $rtl;
}
function try_runtime_loading_if_applicable()
{
$rtl_path = get_runtime_loading_path_if_applicable();
if (!empty($rtl_path)) {
return runtime_loading($rtl_path);
} else {
return $rtl_path;
}
}
function runtime_loading_instructions()
{
$default = get_default_address();
echo '<h4>Runtime Loading Instructions</h4>';
echo '<div class=panel>';
echo '<p>On your shared server the Loader can be installed using the runtime loading method.';
echo " (<a href=\"{$default}&manual=1\">Please click here if you are <strong>not</strong> on a shared server</a>.)</p>";
if ('.' == extension_dir()) {
$dirphrase = is_ms_windows()?'folder':'directory';
echo "Please note that on your system the Loader <em>must</em> be present in the same " . $dirphrase . " as the first encoded file accessed.";
}
echo '<ol>';
loader_download_instructions();
$loader_dir = loader_install_instructions(SERVER_SHARED,dirname(__FILE__));
shared_test_instructions();
echo '</ol>';
echo '</div>';
}
function runtime_loading_errors()
{
$errors = array();
$ext_path = extension_dir_path();
if (false === $ext_path) {
$errors[ERROR_RUNTIME_EXT_DIR_NOT_FOUND] = "Extensions directory cannot be found.";
} else {
$expected_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . get_loader_name();
if (!@file_exists($expected_file)) {
$errors[ERROR_RUNTIME_LOADER_FILE_NOT_FOUND] = "The Loader file was expected to be at $expected_file but could not be found.";
} else {
$errors = loader_compatibility_test($expected_file);
}
}
return $errors;
}
function windows_package_name()
{
$sys = get_sysinfo();
$loader = get_loaderinfo();
return (LOADERS_PACKAGE_PREFIX . 'win' . '_' . ($sys['THREAD_SAFE']?'':'nonts_') . strtolower($sys['PHP_COMPILER']) . '_' . $loader['arch']);
}
function unix_package_name()
{
$sysinfo = get_sysinfo();
$loader = get_loaderinfo();
$multiple_os_versions = false;
if (is_array($loader) && array_key_exists('osvariants',$loader) && is_array($loader['osvariants'])) {
$versions = array_values($loader['osvariants']);
$multiple_os_versions = !empty($versions[0]);
}
if ($multiple_os_versions) {
list($reqd_version,$exact_match) = get_reqd_version($loader['osvariants']);
if ($reqd_version) {
$basename = LOADERS_PACKAGE_PREFIX . $loader['oscode'] . '_' . $reqd_version . '_' . $loader['arch'];
} else {
$basename = "";
}
} else {
$basename = LOADERS_PACKAGE_PREFIX . $loader['oscode'] . '_' . $loader['arch'];
}
return array($basename,$multiple_os_versions);
}
function loader_download_instructions()
{
$sysinfo = get_sysinfo();
$loader = get_loaderinfo();
$multiple_os_versions = false;
if (is_ms_windows()) {
if (is_bool($sysinfo['THREAD_SAFE'])) {
$download_str = '<li>Download the following archive of Windows ' . $sysinfo['PHP_COMPILER'];
if (!$sysinfo['THREAD_SAFE']) {
$download_str .= ' non-TS';
}
$download_str .= ' ' . $loader['arch'] . ' Loaders:';
echo $download_str;
$basename = windows_package_name();
echo make_archive_list($basename,array('zip'));
echo 'A Loaders archive can also be downloaded from <a href="' . LOADERS_PAGE . '" target="loaders">' . LOADERS_PAGE . '</a>.';
} else {
echo '<li>Download a Windows Loaders archive from <a href="' . LOADERS_PAGE . '" target=loaders>here</a>. If PHP is built with thread safety disabled, use the Windows non-TS Loaders.';
}
} else {
list($basename,$multiple_os_versions) = unix_package_name();
if ($basename == "") {
echo '<li>Download a ' . $loader['osname'] . ' ' . $loader['arch'] . ' Loaders archive from <a href="' . LOADERS_PAGE . '" target="loaders">here</a>.';
echo "<br>Your system appears to be ${loader['osnamequal']} for ${loader['wordsize']} bit. If Loaders are not available for that exact release of ${loader['osname']}, Loaders built for an earlier release should work. Note that you may need to install back compatibility libraries for the operating system.";
echo '<br>If you cannot find a suitable loader then please raise a ticket at <a href="'. SUPPORT_SITE . '">our support helpdesk</a>.';
} else {
echo '<li>Download one of the following archives of Loaders for ' . $loader['osnamequal'] . ' ' . $loader['arch'] . ':';
if (SERVER_SHARED == find_server_type()) {
$archives = array('zip','tar.gz');
} else {
$archives = array('tar.gz','zip');
}
echo make_archive_list($basename,$archives);
echo "</p>";
if ($multiple_os_versions && !$exact_match) {
echo "<p>Note that you may need to install back compatibility libraries for ${loader['osname']}.</p>";
}
}
}
echo '</li>';
}
function ini_dir()
{
$sysinfo = get_sysinfo();
$parent_dir = '';
if (!empty($sysinfo['PHP_INI'])) {
$parent_dir = dirname($sysinfo['PHP_INI']);
} else {
$parent_dir = $_SERVER["PHPRC"];
if (@is_file($parent_dir)) {
$parent_dir = dirname($parent_dir);
}
}
return $parent_dir;
}
function unix_install_dir()
{
$ext_dir = extension_dir_path();
$cur_dir = @realpath('.');
if (empty($ext_dir) || $ext_dir == $cur_dir) {
$loader_dir = UNIX_SYSTEM_LOADER_DIR;
} else {
$loader_dir = $ext_dir;
}
return $loader_dir;
}
function windows_install_dir()
{
$sysinfo = get_sysinfo();
if ($sysinfo['SS'] == 'IIS') {
if (false === ($ext_dir = extension_dir_path())) {
$parent_dir = ini_dir();
$ext_dir = $parent_dir . '\\ext';
if (!empty($parent_dir) && @file_exists($ext_dir)) {
$loader_dir = $ext_dir;
} else {
$loader_dir = $_SERVER['windir'] . '\\' . WINDOWS_IIS_LOADER_DIR;
}
} else {
$loader_dir = $ext_dir;
}
} else {
if (false === ($ext_dir = extension_dir_path())) {
$parent_dir = ini_dir();
$loader_dir = $parent_dir . '\\' . 'ioncube';
} else {
$loader_dir = $ext_dir;
}
}
return $loader_dir;
}
function loader_install_dir($server_type)
{
if (SERVER_SHARED == $server_type && own_php_ini_possible()) {
$loader_dir = get_default_loader_dir_webspace();
} elseif (is_ms_windows()) {
$loader_dir = windows_install_dir();
} else {
$loader_dir = unix_install_dir();
}
return $loader_dir;
}
function writeable_directories()
{
$root_path = @realpath($_SERVER['DOCUMENT_ROOT']);
$above_root_path = @realpath($_SERVER['DOCUMENT_ROOT'] . "/..");
$root_path_cgi_bin = @realpath($_SERVER['DOCUMENT_ROOT'] . "/cgi-bin");
$above_root_cgi_bin = @realpath($_SERVER['DOCUMENT_ROOT'] . "/../cgi-bin");
$paths = array();
foreach (array($root_path,$above_root_path,$root_path_cgi_bin,$above_root_cgi_bin) as $p) {
if (@is_writeable($p)) {
$paths[] = $p;
}
}
return $paths;
}
function loader_install_instructions($server_type,$loader_dir = '')
{
if (empty($loader_dir)) {
$loader_dir = loader_install_dir($server_type);
}
if (SERVER_LOCAL == $server_type) {
echo "<li>Put the Loader files in <code>$loader_dir</code></li>";
} else {
echo "<li>Transfer the Loaders to your web server and install in <code>$loader_dir</code></li>";
}
return $loader_dir;
}
function zend_extension_lines($loader_dir)
{
$zend_extension_lines = array();
$sysinfo = get_sysinfo();
$qt = (is_ms_windows()?'"':'');
$loader = get_loaderinfo();
if (!is_bool($sysinfo['THREAD_SAFE']) || !$sysinfo['THREAD_SAFE']) {
$path = $qt . $loader_dir . DIRECTORY_SEPARATOR . $loader['file'] . $qt;
$zend_extension_lines[] = "zend_extension = " . $path;
}
if ((!is_bool($sysinfo['THREAD_SAFE']) && !is_php_version_or_greater(5,3)) || $sysinfo['THREAD_SAFE']) {
$line_start = is_php_version_or_greater(5,3)?'zend_extension':'zend_extension_ts';
$path = $qt . $loader_dir . DIRECTORY_SEPARATOR . $loader['file_ts'] . $qt;
$zend_extension_lines[] = $line_start . " = " . $path;
}
return $zend_extension_lines;
}
function user_ini_base()
{
$doc_root_path = realpath($_SERVER['DOCUMENT_ROOT']);
$above_root_path = @realpath($_SERVER['DOCUMENT_ROOT'] . "/..");
if (!empty($above_root_path) && @is_writeable($above_root_path)) {
$start_path = $above_root_path;
} else {
$start_path = $doc_root_path;
}
return $start_path;
}
function user_ini_space_path($file)
{
$user_base = user_ini_base();
$fpath = @realpath($file);
if (!empty($fpath) && (0 === strpos($fpath,$user_base))) {
return $fpath;
} else {
return false;
}
}
function default_ini_path()
{
return (realpath($_SERVER['DOCUMENT_ROOT']));
}
function shared_ini_location()
{
$phprc = getenv('PHPRC');
if (!empty($phprc)) {
$phprc_path = user_ini_space_path($phprc);
if (false !== $phprc_path) {
return $phprc_path;
} else {
return default_ini_path();
}
} else {
return default_ini_path();
}
}
function zend_extension_instructions($server_type,$loader_dir)
{
$sysinfo = get_sysinfo();
$base = get_base_address();
$editing_ini = true;
$php_ini_name = ini_file_name();
if (isset($sysinfo['PHP_INI']) && @file_exists($sysinfo['PHP_INI'])) {
$php_ini_path = $sysinfo['PHP_INI'];
} else {
$php_ini_path = '';
}
if (is_bool($sysinfo['THREAD_SAFE'])) {
$kwd = zend_extension_line_start();
} else {
$kwd = 'zend_extension/zend_extension_ts';
}
$server_type_code = server_type_code();
$zend_extension_lines = zend_extension_lines($loader_dir);
if (SERVER_SHARED == $server_type && own_php_ini_possible()) {
$ini_dir = shared_ini_location();
$php_ini_path = $ini_dir . DIRECTORY_SEPARATOR . $php_ini_name;
if (@file_exists($php_ini_path)) {
$edit_line = "<li>Edit the <code>$php_ini_name</code> in the <code>$ini_dir</code> directory";
if (zend_extension_line_missing($php_ini_path) && @is_writeable($php_ini_path) && @is_writeable($ini_dir)) {
if (function_exists('file_get_contents')) {
$ini_strs = @file_get_contents($php_ini_path);
} else {
$lines = @file($php_ini_path);
$ini_strs = join(' ',$lines);
}
$fh = @fopen($php_ini_path,"wb");
if ($fh !== false) {
foreach ($zend_extension_lines as $zl) {
fwrite($fh,$zl . PHP_EOL);
}
fwrite($fh,$ini_strs);
fclose($fh);
$editing_ini = false;
echo "<li>Your php.ini file at $php_ini_path has been modified to include the necessary line for the ionCube Loader.";
} else {
echo $edit_line;
}
} else {
echo $edit_line;
}
} else {
$download_ini_file = "<li><a href=\"$base&page=phpconfig&ininame=$php_ini_name&stype=$server_type_code&download=1&prepend=1\">Save this <code>$php_ini_name</code> file</a> and upload it to <code>$ini_dir</code> (full path on your server).";
if (@is_writeable($ini_dir)) {
$fh = @fopen($php_ini_path,"wb");
if ($fh !== false) {
foreach ($zend_extension_lines as $zl) {
fwrite($fh,$zl . PHP_EOL);
}
if (!empty($sysinfo['PHP_INI']) && is_readable($sysinfo['PHP_INI'])) {
if (function_exists('file_get_contents')) {
$ini_strs = @file_get_contents($sysinfo['PHP_INI']);
} else {
$lines = @file($sysinfo['PHP_INI']);
$ini_strs = join(' ',$lines);
}
fwrite($fh,$ini_strs);
}
fclose($fh);
echo "<li>A <code>$php_ini_name</code> file has been created for you in <code>$ini_dir</code>.";
} else {
echo $download_ini_file;
}
} else {
echo $download_ini_file;
}
$editing_ini = false;
}
} elseif (!empty($sysinfo['PHP_INI'])) {
if (empty($sysinfo['PHP_INI_DIR'])) {
echo "<li>Edit the file <code>${sysinfo['PHP_INI']}</code>";
} else {
$php_ini_path = find_additional_ioncube_ini();
if (empty($php_ini_path)) {
$php_ini_name = ADDITIONAL_INI_FILE_NAME;
echo "<li><a href=\"$base&page=phpconfig&download=1&newlinesonly=1&ininame=$php_ini_name&stype=$server_type_code\">Save this $php_ini_name file</a> and put it in your ini files directory, <code>${sysinfo['PHP_INI_DIR']}</code>";
$editing_ini = false;
} else {
$php_ini_name = basename($php_ini_path);
echo "<li>Edit the file <code>$php_ini_path</code>";
}
}
} else {
echo "<li>Edit the system <code>$php_ini_name</code> file";
}
if ($editing_ini) {
echo " and <b>before</b> any other $kwd lines ensure that the following is included:<br>";
foreach ($zend_extension_lines as $zl) {
echo "<code>$zl</code><br>";
}
if (!empty($php_ini_path)) {
if (zend_extension_line_missing($php_ini_path)) {
echo "<a>Alternatively, replace your current <code>$php_ini_path</code> file with <a href=\"$base&page=phpconfig&ininame=$php_ini_name&stype=$server_type_code&download=1&prepend=1\">this new $php_ini_name file</a>.";
}
}
}
echo '</li>';
}
function server_restart_instructions()
{
$sysinfo = get_sysinfo();
$base = get_base_address();
if ($sysinfo['SS']) {
if ($sysinfo['SS'] == 'PHP-FPM') {
echo "<li>Restart PHP-FPM.</li>";
} else {
echo "<li>Restart the ${sysinfo['SS']} server software.</li>";
}
} else {
echo "<li>Restart the server software.</li>";
}
echo "<li>When the server software has restarted, <a href=\"$base&page=loader_check\" onclick=\"showOverlay();\">click here to test the Loader</a>.</li>";
if ($sysinfo['SS'] && $sysinfo['SS'] == 'PHP-FPM') {
echo '<li>If the Loader installation failed, check the PHP-FPM error log file for errors.</li>';
} elseif ($sysinfo['SS'] == 'Apache' && !is_ms_windows()) {
echo '<li>If the Loader installation failed, check the Apache error log file for errors and see our guide to <a target="unix_errors" href="'. UNIX_ERRORS_URL . '">Unix related errors</a>.</li>';
}
}
function shared_test_instructions()
{
$base = get_base_address();
echo "<li><a href=\"$base&page=loader_check\" onclick=\"showOverlay();\">Click here to test the Loader</a>.</li>";
}
function link_to_php_ini_instructions()
{
$default = get_default_address();
echo "<p><a href=\"{$default}&stype=s&ini=1\">Please click here for instructions on using the php.ini method instead</a>.</p>";
}
function php_ini_instruction_list($server_type)
{
echo '<h4>Installation Instructions</h4>';
echo '<div class=panel>';
echo '<ol>';
loader_download_instructions();
$loader_dir = loader_install_instructions($server_type);
zend_extension_instructions($server_type,$loader_dir);
if ($server_type != SERVER_SHARED || !own_php_ini_possible()) {
server_restart_instructions();
} else {
shared_test_instructions();
}
echo '</ol>';
echo '</div>';
}
function php_ini_install_shared($give_preamble = true)
{
$php_ini_name = ini_file_name();
$default = get_default_address();
if ($give_preamble) {
echo "<p>On your <strong>shared</strong> server, the Loader should be installed using a <code>$php_ini_name</code> configuration file.";
echo " (<a href=\"{$default}&manual=1\">Please click here if you are <strong>not</strong> on a shared server</a>.)</p>";
}
if (own_php_ini_possible()) {
echo '<p>With your hosting account, you may be able to use your own PHP configuration file.</p>';
} else {
echo "<p>It appears that you cannot install the ionCube Loader using the <code>$php_ini_name</code> file. Your server provider or system administrator should be able to perform the installation for you. Please refer them to the following instructions.</p>";
}
php_ini_instruction_list(SERVER_SHARED);
}
function php_ini_install($server_type_desc = null, $server_type = SERVER_DEDICATED, $required = true)
{
$php_ini_name = ini_file_name();
$default = get_default_address();
echo '<p>';
if ($server_type_desc) {
echo "For a <strong>$server_type_desc</strong> server ";
} else {
echo "For this server ";
}
if ($required) {
echo "you should install the ionCube Loader using the <code>$php_ini_name</code> configuration file.";
} else {
echo "installing the ionCube Loader using the <code>$php_ini_name</code> file is recommended.";
}
if ($server_type_desc) {
echo " (<a href=\"{$default}&manual=1\">Please click here if you are <strong>not</strong> on a $server_type_desc server</a>.)";
}
echo '</p>';
php_ini_instruction_list($server_type);
}
function help_resources($error_list = array())
{
$self = get_self();
$base = get_base_address();
$server_type_code = server_type_code();
$server_type = find_server_type();
$sysinfo = get_sysinfo();
$resources = array(
'<a target="_blank" href="' . LOADERS_FAQ_URL . '">ionCube Loaders FAQ</a>',
'<a target="_blank" href="' . LOADER_FORUM_URL . '">ionCube Loader Forum</a>'
);
if (SERVER_SHARED != $server_type || own_php_ini_possible(true)) {
$support_info = array (
'department' => WIZARD_SUPPORT_TICKET_DEPARTMENT,
'subject' => "ionCube Loader installation problem",
'message' => support_ticket_information()
);
if (SERVER_LOCAL == $server_type && !info_should_be_disabled()) {
$temp_files = system_info_temporary_files();
} else {
$temp_files = NULL;
}
if (!empty($temp_files)) {
$support_info['ini'] = base64_encode(file_get_contents($temp_files['ini']));
$support_info['phpinfo'] = base64_encode(file_get_contents($temp_files['phpinfo']));
$support_info['additional'] = base64_encode(file_get_contents($temp_files['additional']));
$loader_path = find_loader(true);
if (is_string($loader_path)) {
$support_info['loader'] = base64_encode(file_get_contents($loader_path));
$support_info['loader_name'] = basename($loader_path);
} else {
$support_info['loader'] = '';
$support_info['loader_name'] = '';
}
} else {
$support_info['ini'] = '';
$support_info['phpinfo'] = '';
$support_info['additional'] = '';
$support_info['loader'] = '';
$support_info['loader_name'] = '';
}
$resources[2] = '<form action="' . SUPPORT_SITE . 'lw_index.php' .'" method="POST" id="support-ticket"><a href="" onclick="document.getElementById(\'support-ticket\').submit(); return false;">Raise a support ticket through our helpdesk</a>';
$resources[2] .= '<input type="hidden" name="department" value="' . $support_info['department'] . '"/>';
$resources[2] .= '<input type="hidden" name="subject" value="' . $support_info['subject'] . '"/>';
$resources[2] .= '<input type="hidden" name="message" value="' . $support_info['message'] . '"/>';
if (!empty($temp_files)) {
$resources[2] .= '<input type="hidden" name="phpinfo" value="' . $support_info['phpinfo'] . '"/>';
$resources[2] .= '<input type="hidden" name="ini" value="' . $support_info['ini'] . '"/>';
$resources[2] .= '<input type="hidden" name="additional" value="' . $support_info['additional'] . '"/>';
$resources[2] .= '<input type="hidden" name="loader" value="' . $support_info['loader'] . '"/>';
$resources[2] .= '<input type="hidden" name="loader_name" value="' . $support_info['loader_name'] . '"/>';
}
$resources[2] .= '</form>';
}
if (SERVER_SHARED == $server_type && own_php_ini_possible(true) && !user_ini_space_path($sysinfo['PHP_INI'])) {
$resources[3] = '<strong>Please check with your host that you can create php.ini files that will override the system one.</strong>';
}
return $resources;
}
function system_info_temporary_files()
{
$tmpfname_ini = get_tempnam("/tmp", "INI");
$tmpfname_ini .= ".ini";
$fh_ini = @fopen($tmpfname_ini,'wb');
if ($fh_ini) {
$config = all_ini_contents();
fwrite($fh_ini,$config);
fclose($fh_ini);
} else {
$tmpfname_ini = '';
}
$tmpfname_pinf = get_tempnam("/tmp", "PIN");
$tmpfname_pinf .= ".html";
$fh_pinfo = @fopen($tmpfname_pinf,'wb');
if ($fh_pinfo) {
ob_start();
@phpinfo();
$pinfo = ob_get_contents();
ob_end_clean();
fwrite($fh_pinfo,$pinfo);
fclose($fh_pinfo);
} else {
$tmpfname_pinf = '';
}
$tmpfname_add = get_tempnam("/tmp", "ADD");
$tmpfname_add .= ".html";
$fh_add = @fopen($tmpfname_add,'wb');
if ($fh_add) {
ob_start();
extra_page(false);
$extra = ob_get_contents();
ob_end_clean();
fwrite($fh_add,$extra);
fclose($fh_add);
} else {
$tmpfname_add = '';
}
if (empty($tmpfname_ini) || empty($tmpfname_pinf) || empty($tmpfname_add)) {
return (array());
} else {
return (array('ini' => $tmpfname_ini,
'phpinfo' => $tmpfname_pinf,
'additional' => $tmpfname_add));
}
}
function get_tempnam($default_tmp_dir = '', $prefix = '')
{
if (function_exists('sys_get_temp_dir')) {
return tempnam(sys_get_temp_dir(),$prefix);
} else {
return @tempnam($default_tmp_dir, $prefix);
}
}
function system_info_archive_page()
{
info_disabled_check();
$server_type = find_server_type();
if (SERVER_LOCAL != $server_type) {
exit;
}
$loader = find_loader(true);
if (is_string($loader)) {
$loader_file = $loader;
} else {
$loader_file = '';
}
$all_files = system_info_temporary_files();
if (!empty($all_files)) {
if (!empty($loader_file)) {
$all_files['loader'] = $loader_file;
}
$archive_name = get_tempnam('/tmp',"ARC");
if (extension_loaded('zip')) {
$archive_name .= '.zip';
$zip = @new ZipArchive();
$mode = @constant("ZIPARCHIVE::OVERWRITE");
if (!$zip || $zip->open($archive_name, $mode)!==TRUE) {
$archive_name = '';
} else {
foreach($all_files as $f) {
$zip->addFile($f,basename($f));
}
$zip->close();
}
} elseif (extension_loaded('zlib') && !is_ms_windows()) {
$tar_name = $archive_name . ".tar";
$all_files_str = join(' ',$all_files);
$script = "tar -chf $tar_name $all_files_str";
$result = @system($script,$retval);
if ($result !== false) {
$archive_name = $tar_name . '.gz';
$zp = gzopen($archive_name,"w9");
$tar_contents = get_file_contents($tar_name);
gzwrite($zp,$tar_contents);
gzclose($zp);
} else {
$archive_name = '';
}
} else {
$archive_name = '';
}
} else {
$archive_name = '';
}
if ($archive_name) {
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='. $archive_name);
@readfile($archive_name);
} else {
$self = get_self();
$base = get_base_address();
$server_type_code = server_type_code();
heading();
echo "<p>A downloadable archive of system information could not be created.<br>
<strong>Please save each of the following and then attach those files to the support ticket:</strong></p>";
echo "<ul>";
echo "<li><a href=\"$base&page=phpinfo\" target=\"phpinfo\">phpinfo()</a></li>";
echo "<li><a href=\"$base&page=phpconfig\" target=\"phpconfig\">config</a></li>";
echo "<li><a href=\"$base&page=extra&stype=$server_type_code\" target=\"extra\">additional information</a></li>";
echo "<li><a href=\"$self?page=loaderbin\">loader file</a></li>";
echo "</ul>";
footer(true);
}
}
function support_ticket_information($error_list = array())
{
$sys = get_sysinfo();
$ld = get_loaderinfo();
$ticket_strs = array();
$ticket_strs[] = "PLEASE DO NOT REMOVE THE FOLLOWING INFORMATION\r\n";
$ticket_strs[] = "==============\r\n";
if (!empty($error_list)) {
$ticket_strs[] = "[hr]";
$ticket_strs[] = "ERRORS";
$ticket_strs[] = "[table]";
$ticket_strs[] = '[tr][td]' . join('[/td][/tr][tr][td]',$error_list) . '[/td][/tr]';
$ticket_strs[] = "[/table]";
}
$ticket_strs[] = "[hr]";
$ticket_strs[] = "SYSTEM INFORMATION";
$info_lines = array();
$info_lines["Wizard version"] = script_version();
$info_lines["PHP uname"] = $ld['uname'];
$info_lines["Machine architecture"] = $ld['arch'];
$info_lines["Word size"] = $ld['wordsize'];
$info_lines["Operating system"] = $ld['osname'] . ' ' . $ld['osver'];
if (selinux_is_enabled() || possibly_selinux()) {
$info_lines["Security enhancements"] = "SELinux";
} elseif (grsecurity_is_enabled()) {
$info_lines["Security enhancements"] = "Grsecurity";
} else {
$info_lines["Security enhancements"] = "None";
}
$info_lines["PHP version"] = PHP_VERSION;
if ($sys['DEBUG_BUILD']) {
$info_lines["DEBUG BUILD"] = "DEBUG BUILD OF PHP";
}
if (!$sys['SUPPORTED_COMPILER']) {
$info_lines["SUPPORTED PHP COMPILER"] = "FALSE";
$info_lines["PHP COMPILER"] = $sys['PHP_COMPILER'];
}
$info_lines["Is CLI?"] = ($sys['IS_CLI']?"Yes":"No");
$info_lines["Is CGI?"] = ($sys['IS_CGI']?"Yes":"No");
$info_lines["Is thread-safe?"] = ($sys['THREAD_SAFE']?"Yes":"No");
$info_lines["Web server"] = $sys['FULL_SS'];
$info_lines["Server type"] = server_type_string();
$info_lines["PHP ini file"] = $sys['PHP_INI'];
if (!@file_exists($sys['PHP_INI'])) {
$info_lines["Ini file found"] = "INI FILE NOT FOUND";
} else {
if (is_readable($sys['PHP_INI'])) {
$info_lines["Ini file found"] = "INI FILE READABLE";
} else {
$fh = @fopen($sys['PHP_INI'],"rb");
if ($fh === false) {
$info_lines["Ini file found"] = "INI FILE FOUND BUT POSSIBLY NOT READABLE";
} else {
$info_lines["Ini file found"] = "INI FILE READABLE";
}
}
}
$info_lines["PHPRC"] = $sys['PHPRC'];
$loader_path = find_loader();
if (is_string($loader_path)) {
$info_lines["Loader path"] = $loader_path;
$info_lines["Loader file size"] = filesize($loader_path) . " bytes.";
$info_lines["Loader MD5 sum"] = md5_file($loader_path);
} else {
$info_lines["Loader path"] = "LOADER PATH NOT FOUND";
}
$server_type_code = server_type_code();
if (!empty($_SESSION['hostprovider'])) {
$info_lines['Hosting provider'] = $_SESSION['hostprovider'];
$info_lines['Provider URL'] = $_SESSION['hosturl'];
}
$info_lines["Wizard script path"] = '[url]http://' . $_SERVER["HTTP_HOST"] . get_self() . '?stype='. $server_type_code . '[/url]';
$ticket_strs[] = "[table]";
foreach ($info_lines as $h => $i) {
$value = (empty($i))?'EMPTY':$i;
$ticket_strs[] = '[tr][td]' . $h . '[/td]' . '[td]' . $value . '[/td][/tr]';
}
$ticket_strs[] = '[/table]';
$ticket_strs[] = '[hr]';
$ticket_strs[] = "\r\n==============\r\n";
$ticket_strs[] = "PLEASE ENTER ANY ADDITIONAL INFORMATION BELOW\r\n";
$support_ticket_str = join('',$ticket_strs);
return urlencode($support_ticket_str);
}
function wizard_stats_data($page_id)
{
$data = array();
try_runtime_loading_if_applicable();
$sysinfo = get_sysinfo();
$ldinfo = get_loaderinfo();
$data['sessionid'] = session_id();
$data['wizard_version'] = script_version();
$data['server_type'] = server_type_code();
$data['hostprovider'] = (isset($_SESSION['hostprovider']))?$_SESSION['hostprovider']:'';
$data['hosturl'] = (isset($_SESSION['hosturl']))?$_SESSION['hosturl']:'';
$data['page_id'] = $page_id;
$data['loader_state'] = (extension_loaded(LOADER_EXTENSION_NAME))?'installed':'failure';
$data['ini_location'] = $sysinfo['PHP_INI'];
$data['is_cgi'] = ($sysinfo['IS_CGI'])?"yes":"no";
$data['is_ts'] = ($sysinfo['THREAD_SAFE'])?"yes":"no";
$data['arch'] = $ldinfo['arch'];
$data['php_version'] = PHP_VERSION;
$data['os'] = $ldinfo['osname'];
$data['word_size'] = $ldinfo['wordsize'];
$data['referrer'] = $_SERVER["HTTP_HOST"] . get_self();
return $data;
}
function send_stats($page_id = 'default')
{
$server_type = find_server_type();
$res = false;
if (SERVER_LOCAL != $server_type) {
$stats_data = wizard_stats_data($page_id);
if (!isset($_SESSION['stats_sent'][$page_id][$stats_data['loader_state']])) {
$url = WIZARD_STATS_URL;
if (!empty($stats_data)) {
if(function_exists('http_build_query')) {
$qparams = http_build_query($stats_data);
} else {
$qparams = php4_http_build_query($stats_data);
}
$url .= '?' . $qparams;
$res = remote_file_contents($url);
}
$_SESSION['stats_sent'][$page_id][$stats_data['loader_state']] = 1;
} else {
$res = true;
}
} else {
$res = 'LOCAL';
}
return $res;
}
function os_arch_string_check($loader_str)
{
$errors = array();
if (preg_match("/target os:\s*(([^_]+)_([^-]*)-([[:graph:]]*))/i",$loader_str,$os_matches)) {
$loader_info = get_loaderinfo();
$dirname = calc_dirname();
$packed_osname = preg_replace('/\s/','',strtolower($loader_info['osname']));
if (strtolower($dirname) != $os_matches[1] && $packed_osname != $os_matches[2]) {
$errors[ERROR_LOADER_WRONG_OS] = "You have the wrong loader for your operating system, ". $loader_info['osname'] . ".";
} else {
$loader_wordsize = (strpos($os_matches[3],'64') === false)?32:64;
if ($loader_info['arch'] != ($ap = required_loader_arch($os_matches[3],$loader_info['oscode'],$loader_wordsize))) {
$err_str = "You have the wrong loader for your machine architecture.";
$err_str .= " Your system is " . $loader_info['arch'];
$err_str .= " but the loader you are using is for " . $ap . ".";
$errors[ERROR_LOADER_WRONG_ARCH] = $err_str;
}
}
}
return $errors;
}
function get_loader_strings($loader_location)
{
if (function_exists('file_get_contents')) {
$loader_strs = @file_get_contents($loader_location);
} else {
$lines = @file($loader_location);
$loader_strs = join(' ',$lines);
}
return $loader_strs;
}
function loader_system($loader_location)
{
$loader_system = array();
$loader_strs = get_loader_strings($loader_location);
if (!empty($loader_strs)) {
if (preg_match("/ioncube_loader_..?\.._(.)\.(.)\.(..?)(_nonts)?(_amd64)?\.dll/i",$loader_strs,$version_matches)) {
$loader_system['oscode'] = 'win';
$loader_system['thread_safe'] = (isset($version_matches[4]) && $version_matches[4] == '_nonts')?0:1;
if (preg_match("/_localtime([0-9][0-9])/i",$loader_strs,$size_matches)) {
$loader_system['wordsize'] = ($size_matches[1] == '64')?64:32;
} else {
$loader_system['wordsize'] = 32;
}
$loader_system['arch'] = ($loader_system['wordsize'] == 64)?'x86-64':'x86';
$loader_system['php_version_major'] = $version_matches[1];
$loader_system['php_version_minor'] = $version_matches[2];
if ($loader_system['php_version_major'] == 7 && $loader_system['php_version_minor'] >= 2) {
$loader_system['compiler'] = 'VC15';
} elseif ($loader_system['php_version_major'] == 7 && $loader_system['php_version_minor'] < 2) {
$loader_system['compiler'] = 'VC14';
} elseif ($loader_system['php_version_major'] == 5 && $loader_system['php_version_minor'] >= 5) {
$loader_system['compiler'] = 'VC11';
} elseif (preg_match("/assemblyIdentity.*version=\"([^.]+)\./",$loader_strs,$compiler_matches)) {
$loader_system['compiler'] = "VC" . strtoupper($compiler_matches[1]);
} else {
$loader_system['compiler'] = 'VC6';
}
} elseif (preg_match("/php version:\s*(.)\.(.)\.(..?)(-ts)?/i",$loader_strs,$version_matches)) {
$loader_system['thread_safe'] = (isset($version_matches[4]) && $version_matches[4] == '-ts')?1:0;
$loader_system['php_version_major'] = $version_matches[1];
$loader_system['php_version_minor'] = $version_matches[2];
if (preg_match("/target os:\s*(([^_]+)_([^-]*)-([[:graph:]]*))/i",$loader_strs,$os_matches)) {
$loader_system['oscode'] = strtolower(substr($os_matches[2],0,3));
$loader_system['wordsize'] = (strpos($os_matches[3],'64') === false)?32:64;
$loader_system['arch'] = required_loader_arch($os_matches[3],$loader_system['oscode'],$loader_system['wordsize']);
$loader_system['compiler'] = $os_matches[4];
}
}
if (preg_match("/ionCube Loader Version\s+(\S+)/",$loader_strs,$loader_version)) {
$loader_system['loader_version'] = $loader_version[1];
} elseif (preg_match("/ioncube_loader_(\d{1,2}\.\d\.\d{1,2})\./",$loader_strs,$loader_version)){
$loader_system['loader_version'] = $loader_version[1];
} else {
$loader_system['loader_version'] = 'UNKNOWN';
}
if (isset($loader_system['php_version_major'])) {
$loader_system['php_version'] = $loader_system['php_version_major'] . '.' . $loader_system['php_version_minor'];
}
}
return $loader_system;
}
function loader_compatibility_test($loader_location)
{
$errors = array();
$sysinfo = get_sysinfo();
if (LOADER_NAME_CHECK) {
$installed_loader_name = basename($loader_location);
$expected_loader_name = get_loader_name();
if ($installed_loader_name != $expected_loader_name) {
$errors[ERROR_LOADER_UNEXPECTED_NAME] = "The installed loader (<code>$installed_loader_name</code>) does not have the name expected (<code>$expected_loader_name</code>) for your system. Please check that you have the correct loader for your system.";
}
}
if (empty($errors) && !is_readable($loader_location)) {
$execute_error = "The loader at $loader_location does not appear to be readable.";
$execute_error .= "<br>Please check that it exists and is readable.";
$execute_error .= "<br>Please also check the permissions of the containing ";
$execute_error .= (is_ms_windows()?'folder':'directory') . '.';
if ($sysinfo['SS'] == 'PHP-FPM') {
$execute_error .= "<br>Please also check that PHP-FPM has been restarted.";
} elseif (($sysinfo['SS'] == 'IIS') || !($sysinfo['IS_CGI'] || $sysinfo['IS_CLI'])) {
$execute_error .= "<br>Please also check that the web server has been restarted.";
}
$execute_error .= ".";
$errors[ERROR_LOADER_NOT_READABLE] = $execute_error;
}
$loader_strs = get_loader_strings($loader_location);
$phpv = php_version();
if (preg_match("/php version:\s*(.)\.(.)\.(..?)(-ts)?/i",$loader_strs,$version_matches)) {
if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
$loader_php = $version_matches[1] . "." . $version_matches[2];
$server_php = $phpv['major'] . "." . $phpv['minor'];
$errors[ERROR_LOADER_PHP_MISMATCH] = "The installed loader is for PHP $loader_php but your server is running PHP $server_php.";
}
if (is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'] && !is_ms_windows() && !(isset($version_matches[4]) && $version_matches[4] == '-ts')) {
$errors[ERROR_LOADER_NONTS_PHP_TS] = "Your server is running a thread-safe version of PHP but the loader is not a thread-safe version.";
} elseif (isset($version_matches[4]) && $version_matches[4] == '-ts' && !(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'])) {
$errors[ERROR_LOADER_TS_PHP_NONTS] = "Your server is running a non-thread-safe version of PHP but the loader is a thread-safe version.";
}
} elseif (preg_match("/ioncube_loader_..?\.._(.)\.(.)\.(..?)(_nonts)?(_amd64)?\.dll/i",$loader_strs,$version_matches)) {
if (!is_ms_windows()) {
$errors[ERROR_LOADER_WIN_SERVER_NONWIN] = "You have a Windows loader but your server does not appear to be running Windows.";
} else {
if (isset($version_matches[4]) && $version_matches[4] == '_nonts' && is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) {
$errors[ERROR_LOADER_WIN_NONTS_PHP_TS] = "You have the non-thread-safe version of the Windows loader but you need the thread-safe one.";
} elseif (!(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) && !(isset($version_matches[4]) && $version_matches[4] == '_nonts')) {
$errors[ERROR_LOADER_WIN_TS_PHP_NONTS] = "You have the thread-safe version of the Windows loader but you need the non-thread-safe one.";
}
if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
$loader_php = $version_matches[1] . "." . $version_matches[2];
$server_php = $phpv['major'] . "." . $phpv['minor'];
$errors[ERROR_LOADER_WIN_PHP_MISMATCH] = "The installed loader is for PHP $loader_php but your server is running PHP $server_php.";
}
if ($version_matches[1] == 7 && $version_matches[2] >= 2) {
$loader_compiler = 'VC15';
}
elseif ($version_matches[1] == 7) {
$loader_compiler = 'VC14';
}
elseif ($version_matches[1] == 5 && $version_matches[2] >= 5) {
$loader_compiler = 'VC11';
}
elseif (preg_match("/assemblyIdentity.*version=\"([^.]+)\./",$loader_strs,$compiler_matches)) {
$loader_compiler = "VC" . strtoupper($compiler_matches[1]);
}
else
{
$loader_compiler = 'VC6';
}
if ($loader_compiler != $sysinfo['PHP_COMPILER']) {
$errors[ERROR_LOADER_WIN_COMPILER_MISMATCH] = "Your loader was built using $loader_compiler but you need the loader built using ${sysinfo['PHP_COMPILER']}.";
}
}
} else {
$errors[ERROR_LOADER_PHP_VERSION_UNKNOWN] = "The PHP version for the loader cannot be determined - please check that you have a valid ionCube Loader.";
}
$errors += os_arch_string_check($loader_strs);
return $errors;
}
function shared_server()
{
if (!$rtl_path = runtime_loading()) {
if (empty($_SESSION['use_ini_method']) && runtime_loading_is_possible()) {
runtime_loading_instructions();
} else {
php_ini_install_shared();
}
} else {
list($lv,$mv,$newer_version) = ioncube_loader_version_information();
$phpv = php_version_maj_min();
echo "<p>The ionCube Loader $lv for PHP $phpv has been successfully installed.</p>";
$is_legacy_loader = loader_major_version_instructions($mv);
if ($is_legacy_loader) {
loader_upgrade_instructions($lv,$newer_version);
}
successful_install_end_instructions($rtl_path);
}
}
function dedicated_server()
{
php_ini_install('dedicated or VPS', SERVER_DEDICATED, true);
}
function local_install()
{
php_ini_install('local',SERVER_LOCAL, true);
}
function unregister_globals()
{
if (!ini_get('register_globals')) {
return;
}
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die('GLOBALS overwrite attempt detected');
}
$noUnset = array('GLOBALS', '_GET',
'_POST', '_COOKIE',
'_REQUEST', '_SERVER',
'_ENV', '_FILES');
$input = array_merge($_GET, $_POST,
$_COOKIE, $_SERVER,
$_ENV, $_FILES,
isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
foreach ($input as $k => $v) {
if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) {
unset($GLOBALS[$k]);
}
}
}
function clear_session($persist = array())
{
$persist['not_go_daddy'] = empty($_SESSION['not_go_daddy'])?0:1;
$persist['use_ini_method'] = empty($_SESSION['use_ini_method'])?0:1;
$persist['server_type'] = empty($_SESSION['server_type'])?SERVER_UNKNOWN:$_SESSION['server_type'];
@session_destroy();
$_SESSION = array();
$_SESSION['CREATED'] = time();
$_SESSION = $persist;
}
function can_archive()
{
return (extension_loaded('zip') || (extension_loaded('zlib') && !is_ms_windows()));
}
function is_ioncube()
{
return (($_SERVER["REMOTE_ADDR"] == IONCUBE_IP_ADDRESS) || ($_SERVER["REMOTE_ADDR"] == gethostbyname(IONCUBE_ACCESS_ADDRESS)));
}
function can_reach_ioncube()
{
return (isset($_SESSION['remote_access_successful']));
}
function info_should_be_disabled($only_allow_ioncube = false)
{
$elapsed = time() - max(filemtime(__FILE__),filectime(__FILE__));
if (is_ioncube()) {
$cutoff_time = IONCUBE_WIZARD_EXPIRY_MINUTES * 60;
} else {
if (!$only_allow_ioncube && !extension_loaded(LOADER_EXTENSION_NAME)) {
$cutoff_time = WIZARD_EXPIRY_MINUTES * 60;
} else {
return true;
}
}
return ($elapsed > $cutoff_time);
}
function info_disabled_text()
{
return "The information you have tried to access has been disabled for security reasons. Please re-install this Loader Wizard script and try again.";
}
function info_disabled_check()
{
if (info_should_be_disabled()) {
heading();
echo info_disabled_text();
footer(true);
exit;
}
}
function run()
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/googlebot/i',$user_agent)) {
exit;
}
unregister_globals();
if (is_php_version_or_greater(4,3,0)) {
ini_set('session.use_only_cookies',1);
}
$session_ok = @session_start();
if (!defined('PHP_EOL')) {
if (is_ms_windows()) {
define('PHP_EOL',"\r\n");
} else {
define('PHP_EOL',"\n");
}
}
if (!isset($_SESSION['CREATED'])) {
$_SESSION['CREATED'] = time();
} elseif (time() - $_SESSION['CREATED'] > SESSION_LIFETIME_MINUTES * 60 ) {
clear_session();
}
if (!isset($_SERVER)) $_SERVER =& $HTTP_SERVER_VARS;
(php_sapi_name() == 'cli') && die("This script should only be run by a web server.\n");
$page = get_request_parameter('page');
$host = get_request_parameter('host');
$clear = get_request_parameter('clear');
$ini = get_request_parameter('ini');
$timeout = get_request_parameter('timeout');
if ($timeout) {
$_SESSION['timing_out'] = 1;
$_SESSION['initial_run'] = 0;
}
if (!empty($host)) {
if ($host == 'ngd') {
$_SESSION['not_go_daddy'] = 1;
}
}
if (!empty($ini)) {
$_SESSION['use_ini_method'] = 1;
}
if (!empty($clear)) {
clear_session();
unset($_SESSION['not_go_daddy']);
unset($_SESSION['use_ini_method']);
unset($_SESSION['server_type']);
} else {
$stype = get_request_parameter('stype');
$hostprovider = get_request_parameter('hostprovider');
$hosturl = get_request_parameter('hosturl');
if (!empty($hostprovider)) {
$_SESSION['hostprovider'] = $hostprovider;
$_SESSION['hosturl'] = $hosturl;
}
$server_type = find_server_type($stype,false,true);
}
if ($session_ok && !$timeout && !isset($_SESSION['initial_run']) && empty($page)) {
$_SESSION['initial_run'] = 1;
initial_page();
@session_write_close();
exit;
} else {
$_SESSION['initial_run'] = 0;
}
if (empty($_SESSION['server_type'])) {
$_SESSION['server_type'] = SERVER_UNKNOWN;
}
if (empty($page) || !function_exists($page . "_page")) {
$page = get_default_page();
}
$fn = "${page}_page";
$fn();
@session_write_close();
exit(0);
}
function wizardversion_page()
{
$start_time = time();
$wizard_version_only = get_request_parameter('wizard_only');
$clear_session_info = get_request_parameter('clear_info');
if ($clear_session_info) {
unset($_SESSION['timing_out']);
unset($_SESSION['latest_wizard_version']);
}
$wizard_version = latest_wizard_version();
$message = '';
if (false === $wizard_version) {
$message = "0";
} elseif (update_is_available($wizard_version)) {
$message = "$wizard_version";
} else {
$message = "1";
}
echo $message;
@session_write_close();
exit(0);
}
function platforminfo_page()
{
$message = '';
$platforms = get_loader_platforms();
$message = empty($platforms)?0:1;
echo $message;
@session_write_close();
exit(0);
}
function loaderversion_page()
{
$message = '';
$loader_versions = get_loader_version_info();
$message = empty($loader_versions)?0:1;
echo $message;
@session_write_close();
exit(0);
}
function compilerversion_page()
{
$message = '';
$compiler_versions = find_win_compilers();
$message = empty($compiler_versions)?0:1;
echo $message;
@session_write_close();
exit(0);
}
function initial_page()
{
$self = get_self();
$start_page = get_default_address(false);
$stage_timeout = 7000;
$step_lag = 500;
echo <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ionCube Loader Wizard</title>
<link rel="stylesheet" type="text/css" href="$self?page=css">
<style type="text/css">
body {
height: 100%;
width: 100%;
}
</style>
<script type="text/javascript">
var timingOut = 0;
var xmlHttpTimeout;
var ajax;
var statusPar;
var stage_timeout = $stage_timeout;
var step_lag = $step_lag;
function checkNextStep(ajax,expected,continuation) {
if (ajax.readyState==4 && ajax.status==200)
{
clearTimeout(xmlHttpTimeout);
if (ajax.responseText == expected) {
setTimeout('',step_lag);
continuation();
} else {
statusPar.innerHTML = 'Unable to check for update<br>script continuing';
setTimeout("window.location.href = '$start_page&timeout=1'",1000);
}
}
}
function getXmlHttp() {
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
var startMainLoaderWizard = function() {
window.location.href = '$start_page';
}
var loaderVersionCheck = function() {
statusPar.innerHTML = 'Stage 4/4: Getting latest loader versions';
var xmlHttp = getXmlHttp();
xmlHttp.onreadystatechange=function() {
checkNextStep(xmlHttp,"1",startMainLoaderWizard);
}
xmlHttp.open("GET","$self?page=loaderversion",true);
xmlHttp.send("");
ajax = xmlHttp;
xmlHttpTimeout=setTimeout('ajaxTimeout()',stage_timeout);
}
var platformCheck = function() {
statusPar.innerHTML = 'Stage 3/4: Getting platform information';
var xmlHttp = getXmlHttp();
xmlHttp.onreadystatechange=function() {
checkNextStep(xmlHttp,"1",loaderVersionCheck);
}
xmlHttp.open("GET","$self?page=platforminfo",true);
xmlHttp.send("");
ajax = xmlHttp;
xmlHttpTimeout=setTimeout('ajaxTimeout()',stage_timeout);
}
var compilerVersionCheck = function() {
statusPar.innerHTML = 'Stage 2/4: Getting compiler versions';
var xmlHttp = getXmlHttp();
xmlHttp.onreadystatechange=function() {
checkNextStep(xmlHttp,"1",platformCheck);
}
xmlHttp.open("GET","$self?page=compilerversion",true);
xmlHttp.send("");
ajax = xmlHttp;
xmlHttpTimeout=setTimeout('ajaxTimeout()',stage_timeout);
}
var startChecks = function() {
statusPar = document.getElementById('status');
statusPar.innerHTML = 'Stage 1/4: Getting Loader Wizard version';
var xmlHttp = getXmlHttp();
xmlHttp.onreadystatechange=function() {
checkNextStep(xmlHttp,"1",compilerVersionCheck);
}
xmlHttp.open("GET","$self?page=wizardversion",true);
xmlHttp.send("");
ajax = xmlHttp;
xmlHttpTimeout=setTimeout('ajaxTimeout()',stage_timeout);
}
function ajaxTimeout(){
ajax.abort();
statusPar.innerHTML = 'Cannot reach server<br>script continuing';
setTimeout("window.location.href = '$start_page&timeout=1'",1000);
}
</script>
</head>
<body>
<div id="loading"><script type="text/javascript">document.write('<p>Initialising<br>ionCube Loader Wizard<br><span id="status"></span></p>');</script><p id="noscript">Your browser does not support JavaScript so the ionCube Loader Wizard initialisation cannot be made now. This script can get the latest loader version information from the ionCube server when you go to the next page.<br>Please choose one of the following. <br>If the script appears to hang please restart the script and choose the "NO" option.<br><br><br><a href="$start_page">YES - my server DOES have internet access</a><br><br><a href="$start_page&timeout=1">NO - my server does NOT have internet access</a></p></div>
<script type="text/javascript">
document.getElementById('noscript').style.display = 'none';
window.onload = startChecks;
</script>
</body>
</html>
EOT;
}
function default_page($loader_extension = LOADER_EXTENSION_NAME)
{
$self = get_self();
foreach (array('self') as $vn) {
if (empty($$vn)) {
$server_data = print_r($_SERVER,true);
error("Unable to initialise ($vn)". ' $_SERVER is: ' . $server_data);
}
}
heading();
$wizard_update = check_for_wizard_update(true);
$rtl = try_runtime_loading_if_applicable();
$server_type = find_server_type();
if (extension_loaded($loader_extension) && $server_type != SERVER_UNKNOWN) {
loader_already_installed($rtl);
} else {
loader_not_installed();
}
send_stats('default');
footer($wizard_update);
}
function uninstall_wizard_instructions()
{
echo '<p><strong>For security reasons we advise that you remove this Wizard script from your server now that the ionCube Loader is installed.</strong></p>';
}
function contact_script_provider_instructions()
{
echo '<p>Please contact the script provider if you do experience any problems running encoded files.</p>';
}
function may_need_to_copy_ini()
{
$sys = get_sysinfo();
if (ini_same_dir_as_wizard() && $sys['IS_CGI']) {
$dirphrase = is_ms_windows()?'folder':'directory';
$ini = ini_file_name();
echo "<p>Please note that if encoded files in a different $dirphrase from the Wizard fail then you should attempt to copy the $ini file to each $dirphrase in which you have encoded files.</p>";
}
}
function ioncube_24_is_available()
{
$loaderinfo = get_loaderinfo();
$php_ver = php_version();
return ($loaderinfo['oscode'] == 'lin' && (($php_ver['major'] == 5 && $php_ver['minor'] >= 3) || $php_ver['major'] > 5) );
}
function ioncube_24_is_enabled()
{
$ic24_enabled = ini_get(IC24_ENABLED_INI_PROPERTY);
return $ic24_enabled;
}
function ioncube_24_information()
{
if (ioncube_24_is_available() && !ioncube_24_is_enabled()) {
$self = get_self();
echo '<div class="ic24">';
echo '<div class="ic24graphic">';
echo '<a target="_blank" href="' . IONCUBE24_URL . '"><img id="ic24logo" src="' . $self . '?page=ic24logo" alt="ionCube24 logo"></a>';
echo '</div>';
echo '<div id="ic24info">';
echo '<p><strong>Bonus Features!</strong> The ionCube Loader can also give ';
echo '<strong>real-time intrusion protection</strong> to protect against malware and <strong>PHP error reporting</strong> ';
echo 'to alert when things go wrong on your website.</p>';
echo '<p>These features are disabled by default but easily activated. ';
echo '<strong><a target="_blank" href="' . IONCUBE24_URL . '">visit ioncube24.com</a></strong> to find out more.</p>';
echo '</div>';
echo '</div>';
}
}
function cli_install_instructions()
{
if (is_php_version_or_greater(5,3)) {
$cli_loader_installed = shell_exec('php -r "echo extension_loaded(\"' . LOADER_EXTENSION_NAME . '\");"');
if (!$cli_loader_installed) {
$cli_php_ini_output = shell_exec("php --ini");
$ini_loader_loc = scan_inis_for_loader();
if (!is_null($cli_php_ini_output)) {
echo '<div class="panel">';
echo '<h4>Loader Installation for Command-Line (CLI) PHP</h4>';
echo "<p>At present it does not look like the ionCube Loader is installed for command-line (CLI) PHP.</p>";
echo "<p>Please note that if you need to run the CLI PHP, such as for <strong>cron jobs</strong>, then please ensure the zend_extension line for the ionCube Loader is included in your CLI PHP configuration.</p>";
if (!empty($ini_loader_loc['location'])) {
echo "<p>The zend_extension line that needs to be copied is:</p>";
echo "<p><kbd>zend_extension = " . $ini_loader_loc['location'] . "</kbd></p>";
}
echo "<p>Your CLI PHP Configuration is:</p>";
echo '<div class="terminal">';
echo "<pre>";
echo $cli_php_ini_output;
echo "</pre>";
echo '</div>';
echo '</div>';
}
}
}
}
function successful_install_end_instructions($rtl_path = null)
{
if (empty($rtl_path)) {
may_need_to_copy_ini();
} elseif (is_string($rtl_path)) {
echo "<p>The runtime loading method of installation was used with path <code>$rtl_path</code></p>";
}
contact_script_provider_instructions();
if (is_legacy_platform()) {
legacy_platform_instructions();
}
if (!is_ms_windows() && is_php_version_or_greater(5,3)) {
cli_install_instructions();
}
uninstall_wizard_instructions();
ioncube_24_information();
}
function loader_major_version_instructions($mv)
{
if ($mv < LATEST_LOADER_MAJOR_VERSION) {
echo "<p><strong>The installed version of the Loader cannot run files produced by the most recent ionCube Encoder.</strong>";
echo " You will need a version " . LATEST_LOADER_MAJOR_VERSION . " ionCube Loader to run such files.</p>";
}
return ($mv < LATEST_LOADER_MAJOR_VERSION);
}
function loader_already_installed($rtl = null)
{
list($lv,$mv,$newer_version) = ioncube_loader_version_information();
$phpv = php_version_maj_min();
$php_str = ' for PHP ' . $phpv;
echo '<div class="success">';
echo '<h4>Loader Installed</h4>';
if ($newer_version) {
echo '<p>The ionCube Loader version ' . $lv . $php_str . ' is <strong>already installed</strong> but it is an old version.';
echo ' It is recommended that the Loader be upgraded to the latest version if possible.</p>';
$know_latest_version = is_string($newer_version);
$is_legacy_loader = loader_major_version_instructions($mv);
echo '</div>';
loader_upgrade_instructions($lv,$newer_version);
} else {
echo '<p>The ionCube Loader version ' . $lv . $php_str . ' is already installed and encoded files should run without problems.</p>';
echo '</div>';
$is_legacy_loader = loader_major_version_instructions($mv,true);
if ($is_legacy_loader) {
loader_upgrade_instructions($lv,true);
}
}
successful_install_end_instructions($rtl);
}
function loader_upgrade_instructions($installed_version,$newer_version)
{
if ($newer_version) {
echo '<div class="panel">';
echo '<h4>Loader Upgrade Instructions</h4>';
$restart_needed = true;
$server_type = find_server_type();
if ($server_type == SERVER_SHARED || $server_type == SERVER_UNKNOWN) {
$loader_path = find_loader(true);
if (!is_string($loader_path) || false === user_ini_space_path($loader_path)) {
$verb_case = ($server_type == SERVER_UNKNOWN)?"may":"will";
echo "<p>Please note that you $verb_case need your system administrator to do the following to upgrade. The web server will need to be restarted after the loader file is changed.</p>";
}
$restart_needed = false;
}
if (is_string($newer_version)) {
$version_str = "version $newer_version";
} else {
$version_str = "a newer version";
}
$loader_name = get_loader_name();
echo "<p>To upgrade from version $installed_version to $version_str of the ionCube Loader, please replace your existing loader file, $loader_name, with
the file of the same name from one of the following packages:</p>";
if (is_ms_windows()) {
$basename = windows_package_name();
} else {
list($basename,$multiple_os_versions) = unix_package_name();
}
echo make_archive_list($basename,array('zip','tar.gz'));
if ($restart_needed) {
echo "<p>Once you have replaced the loader file please restart your web server.</p>";
}
echo '</div>';
}
}
function legacy_platform_warning()
{
$leg_warn = '<p><strong>You are on a platform on which ionCube Loaders are no longer being developed. ';
$leg_warn .= 'Loaders on your platform may not be able to run files produced by the latest ionCube Encoder. ';
$leg_warn .= 'Please switch, if possible, to a platform on which loaders are currently supported. ';
$leg_warn .= 'A list of currently supported platforms is shown on our <a href="' . LOADERS_PAGE . '" target="loaders">loaders page</a>.</strong></p>';
return $leg_warn;
}
function legacy_platform_instructions()
{
echo legacy_platform_warning();
}
function loader_not_installed()
{
$loader = get_loaderinfo();
$sysinfo = get_sysinfo();
$stype = get_request_parameter('stype');
$manual_select = get_request_parameter('manual');
$host_type = find_server_type($stype,$manual_select,true);
if ($host_type != SERVER_UNKNOWN && is_array($loader) && !$sysinfo['DEBUG_BUILD']) {
$warnings = server_restriction_warnings();
if (is_legacy_platform()) {
$warnings[] = legacy_platform_warning();
}
if (empty($_SESSION['use_ini_method']) && $host_type == SERVER_SHARED && runtime_loading_is_possible()) {
$errors = runtime_loading_errors();
} else {
$errors = ini_loader_errors();
$warnings = array_merge($warnings,ini_loader_warnings());
}
if (!empty($errors)) {
if (count($errors) > 1) {
$problem_str = "Please note that the following problems currently exist";
} else {
$problem_str = "Please note that the following problem currently exists";
}
echo '<div class="alert">' .$problem_str . ' with the ionCube Loader installation:';
echo make_list($errors,"ul");
echo '</div>';
}
if (!empty($warnings)) {
$addword = empty($errors)?'':'also';
$plural = (count($warnings)>1)?'s':'';
echo '<div class="warning">';
echo "Please note $addword the following issue$plural:";
echo make_list($warnings,"ul");
echo '</div>';
}
}
if (!isset($stype)) {
echo '<p>To use files that have been protected by the <a href="' . ENCODER_URL . '" target=encoder>ionCube PHP Encoder</a>, a component called the ionCube Loader must be installed.</p>';
}
if (!is_supported_php_version()) {
echo '<p>Your server is running PHP version ' . PHP_VERSION . ' and is
unsupported by ionCube Loaders. Recommended PHP 4 versions are PHP 4.2 or higher,
and PHP 5.1 or higher for PHP 5.</p>';
} elseif ($latest_supported_php_