I've got an error

Home / FAQs / I've got an error

I've got an error

1. Got '....parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' [2] - PHP 4.3 compiler error...' 2. I'm getting 'unable to execute ./sgencoder: No such file or directory' in Linux 3. I use version 7 of SourceGuardian. After upgrading PHP to version 5.3 my encrypted files do not work anymore 4. Why do I see my PHP code source when run the encoded version? 5. I'm getting "Internal Error: Failed to expand shell folder constant "userdocs" from the installer. 6. Automatic upgrade fails on Windows with 'Update error: Unable to extract the update to: C:/Program Files (x86)/SourceGuardian' 7. SourceGuardian 11 - Protected script's header is broken 8. SourceGuardian Loader - This protected script does not support version x.y.z of PHP 9. Using the 'sgencoder' CLI encoder on Mac fails with 'image not found' 10. Got a problem running the encoder on Windows because of missed libs? 11. I am getting Code 19 at the end of encoding process... 12. GUI is not staring on Linux 13. VCRUNTIME140.dll error on Windows 14. libjpeg.so.* is missed in Linux when running GUI 15. Linux encoder shared libraries dependencies 16. Linux loaders GLIBC requirements 17. error loading encoder sgencoder5?.dll or sgencoder7?.dll on Windows 18. must be of type int, float given 19. Call to a member function bindTo() on null (mostly with Laravel) 20. For security reasons this protected script cannot run in the current PHP environment. Please contact the author of the script regarding this problem. Error code [16] 21. Call to undefined function func_name()
1. Got '....parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' [2] - PHP 4.3 compiler error...'
It seems your code is not compatible with PHP 4. Please turn off encoding for PHP 4 by deselecting the PHP 4 checkbox in your project settings. If you do not need to encode for PHP 4 but encoding for PHP 4 is on by default when you create a new project, you may change default settings in application preferences

2. I'm getting 'unable to execute ./sgencoder: No such file or directory' in Linux
If you get the above error message on Linux but you are pretty sure that permissions are correct and the execution bit is set, this error is caused by some missing 32-bit libs on a 64-bit machine. Unfortunately, Linux is not very informative in its error messages in this case. Please install 32-bit compatibility libs. If you use Ubuntu/Debian you may do it by running the following command from console:
 
apt-get install ia32-libs
 
SourceGuardian for Linux is available both as 32-bit or 64-bit application. You may use 32-bit version but need to install the above compatibility libs. Protected files may be run on 32-bit or 64-bit. Installing the above package is required only for running 32-bit version of the encoder on a 64-bit machine. Loaders differ for 32-bit and 64-bit and do not require installing additional packages.

3. I use version 7 of SourceGuardian. After upgrading PHP to version 5.3 my encrypted files do not work anymore
Encoding for PHP 5.3 is supported in version 8 of SourceGuardian and newer. If you are using version 7 or older than you may upgrade your copy of SourceGuardian in the user profile.   It's also important to install the latest loader for PHP 5.3. Please find loaders in the version 8 installation package. You may also use our loader assistant to know the loader you need and how to install it http://sourceguardian.com/loaders/download.php

4. Why do I see my PHP code source when run the encoded version?
Your code probably use short PHP tags <? ?>. Enable short PHP tags support in Advanced settings in your SourceGuardian project or use --short-tags option if you prefer to run the encoder from the command line. Re-encode your files.

5. I'm getting "Internal Error: Failed to expand shell folder constant "userdocs" from the installer.
SYMPTOMS:
While installing SourceGuardian on Windows Vista, during the installation the following error occurs with the message: "Internal Error: Failed to expand shell folder constant "userdocs" following "Setup was not completed. Please correct the problem and run Setup again"
 
CAUSE:
This problem is caused from a Vista conflict.
 
RESOLUTION:
Set the folder "my documents" to its default values.
1. Right Click on Start
2. Select Explore from the Menu
3. Right Click on the "My Documents" Folder
4. Click on Properties and it will open up the Document Properties Dialog box
5. Click on the General Tab, this should be the default
6. You will see a small box "Read only" at the bottom next to Attributes - click on this box to untick /de-select this option
7. Click on the Apply button
8. Click on Ok to close the Document Properties dialog and save the changes.
 
Setting back the default value for "My documents" is just a workaround,which usually fixes the default read/write rights for the "MyDocuments" folder.
 
Try installing SourceGuardian again.

6. Automatic upgrade fails on Windows with 'Update error: Unable to extract the update to: C:/Program Files (x86)/SourceGuardian'
If you are running SourceGuardian on Windows 7, 8  or newer and getting the 'Update error: Unable to extract the update to: C:/Program Files (x86)/SourceGuardian' error message during automatic update,
please run the application under administrative account as otherwise the files can't be extracted to the installation folder because of Windows restrictions.

7. SourceGuardian 11 - Protected script's header is broken
If you are using version 11 of SourceGaurdian and getting the error 'SourceGuardian Loader - Protected script's header is broken. Probably the encoded file was modified. Please install an original unmodified file or contact the author of the script to get the original file. Error code [10]', UPDATE THE LOADER. 
 
Please download and install the recent loader from https://www.sourceguardian.com/loaders/ or use the loader assistant https://www.sourceguardian.com/loaders/download.php

8. SourceGuardian Loader - This protected script does not support version x.y.z of PHP
 A problem is that the protected script was not encoded for that version of PHP. Protected scripts include different versions of bytecode for the major versions of PHP selected during encoding. If you need to run the protected file on the newer version of PHP, it is not enough to install a new loader to the target machine. You also need to re-encode the file from source using the recent version of SourceGuardian and in the encoding project select new versions of PHP that you need to support for your code.

9. Using the 'sgencoder' CLI encoder on Mac fails with 'image not found'
If you are trying to run the symlinked CLI encoder from the GUI installation on Mac, it will probably fail with the following error message when doing the actual encoding: 
 
sgencoder4.bundle: dlopen(s/sgencoder4.bundle, 5): image not found
 
This happens because the CLI executable can't find the required bundles. Add the following line to your ~/.profile and restart the Terminal. The line below presumes you installed SourceGuardian GUI to Applications. For other installation paths, please change the line accordingly.
 
export DYLD_LIBRARY_PATH="/Applications/SourceGuardian.app/Contents/MacOS:$DYLD_LIBRARY_PATH"
 

10. Got a problem running the encoder on Windows because of missed libs?
Encoder DLLs for different versions of PHP depend on different standard libraries on Windows. We include the required redistribution pack to the installer but if running of it was cancelled or if another issue had happened during SourceGuardian installation, this might result in missing some of the required standard libraries. In that case the below information may help and you may find and install the missed libraries to your Windows machine.
 
sgencoder71.dll for PHP 7.1 and DLLs for earlier versions of PHP depend on the following libs:
 
    ole32.dll
    USER32.dll
    ADVAPI32.dll
    WS2_32.dll
    DNSAPI.dll
 
sgencoder72.dll for PHP 7.2 dependencies:
 
    ole32.dll
    ADVAPI32.dll
    WS2_32.dll
    DNSAPI.dll
    bcrypt.dll
    VCRUNTIME140.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-utility-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    api-ms-win-crt-filesystem-l1-1-0.dll
 
sgencoder73.dll for PHP 7.3 dependencies:
 
    KERNEL32.dll
    ole32.dll
    ADVAPI32.dll
    WS2_32.dll
    DNSAPI.dll
    bcrypt.dll
    VCRUNTIME140.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-utility-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    api-ms-win-crt-filesystem-l1-1-0.dll
    api-ms-win-crt-conio-l1-1-0.dll
 
Encoder for PHP 7.2 and 7.3+ require UCRT Microsoft package to be installed as well as Microsoft Visual C++ 2015 or 2017 redistributable. 
 
 

11. I am getting Code 19 at the end of encoding process...
The code 19 "directory" on encoding is not an error, it's an indication of copying of an empty folder to the target directory. Time ago we were asked by other customers to include copying of empty folders if they exist in the source and if the target folder is specified. This is to fully reproduce the project directory tree during encoding and include empty folders.

If you check the encoding log, it includes "directory" explanation text for that line.

Since it's a folder we don't count it as an encoded file. Also since it's not an error, we don't count it as an error either. So, ignore code 19 since it's not an error.

12. GUI is not staring on Linux
The recent version 13 of SourceGuardian includes GUI that we reworked with Qt5. That was a serious change and Qt5 apps depend on much more shared libraries. GUI for Linux was build on Debian 10 and must work on it and newer releases of Debian or Ubuntu. It must also work on other modern Linux distros. Sorry, but we did not get a chance to test GUI on other Linux distros or older versions.
 
If SourceGuardian GUI does not start on your Linux, it's very likely that your system is missing some of the required shared libs. In this case, you may use two commands below to try to know what libs are missed and then either email us or try to install them.  Run Terminal app and cd to SourceGuardian installation folder:
 
> ldd ./SourceGuardian | grep "not found"
 
if the above command produces no results, try this:
 
> QT_DEBUG_PLUGINS=1 ./SourceGuardian
 
If any shared libs are missed, you may read about it in the console. Please let us know and we can add them to the application package. 
 
If you need a quick solution for running GUI, you may also try this and install Qt5. (package name and package manager may differ on your Linux)
 
sudo apt-get install qt5-default
 
And finally you may download the CLI version of SourceGuardian which has much less shared libs dependencies or use the CLI version included within GUI in the "bin" subfolder.
 
Below is a quick update to this FAQ which may help.

If you are not using Ubuntu or Debian or they are not the recent, libcurl4 may be missed. You will see it's missed by running ldd on the executable as described above. If this is the case, please install libcurl4
 
Ubuntu/Debian: sudo apt-get install libcurl4
CentOS: sudo yum install libcurl
 
All the Qt5 shared libs are included and you may find them in the "lib" subfolder within the installation folder. But if you are getting a message about missed libQt5Core etc, it means your OS is ignoring relative paths to the shared libs as they are set within the executable. In this case you may try running the encoder GUI with the following command or modify RUNME.sh or create your own shell script:

cd /path/to/sourceguardian/folder
LD_LIBRARY_PATH=/path/to/sourceguardian/folder/lib ./SourceGuardian  
 
(please change the path to the actual path where the application is installed)
 

13. VCRUNTIME140.dll error on Windows
If you are getting a problem encoding for PHP 8 or 8.1 on WIndows and getting an error about  'VCRUNTIME140.dll', it means the Microsoft VC Redistributable packages are not installed on your machine or outdated. This package is included with SourceGuardian and is installed by default but there may be version check issues etc which made it not installed or not updated. 
 
PHP Warning: 'C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll' 14.13 is not compatible with this PHP build linked with 14.28 in Unknown on line 0

In this case please download the VC Redistributable installer from Microsoft. Use the links on the top of the page which mention Visual Studio 2017. You need to download and install the 32-bit version regardless if your windows is 32 or 64-bit. 
 
vc_redist.x86.exe

https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
 
this is a direct download link (if it does not work, use the link above)
 
https://aka.ms/vs/17/release/vc_redist.x86.exe
 
After installing, reboot and then start SourceGuardian and try encoding again.
 

14. libjpeg.so.* is missed in Linux when running GUI
Install the missed library:
 
sudo apt-get install libjpeg62
 
This error may appear on Ubuntu version 12.04 and later, where this library is not installed by default, as it was in earlier versions.

15. Linux encoder shared libraries dependencies
Linux shared libraries dependencies:
 
- Linux CLI encoder and tools include custom libcurl and do not depend on the system one
 
- Linux CLI encoder min GLIBC version is 2.17 (except PHP 5.3 encoder, was 2.27 for all). It means the CLI encoder may run on older Linux systems like CentOS 7 and many others. Automatic registration is available for the CLI version on the first run of the CLI 'sourceguardian' executable. Note: PHP 5.3 encoder still depends on GLIBC 2.27, but you may exclude encoding for it with --phpversion 5.4+ command line option or change to a higher version.
 
- Linux GUI still requires newer Linux with GLIBC 2.27+ It's built on Debian 10 and tested on Debian 10 and Ubuntu with Gnome and Cinnamon desktop IDE. If you use another Linux, GUI may work if all the shared libraries dependencies are resolved. In case GUI does not work, you may use the CLI version on Linux.
 
- if you have libwebp.so.6 error, try this:
sudo apt install libwebp-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/libwebp.so.6

16. Linux loaders GLIBC requirements
 The GLIBC requirements for Linux loaders:
 
- for x64 is GLIBC_2.14
- for aarch64 is GLIBC_2.17
 

17. error loading encoder sgencoder5?.dll or sgencoder7?.dll on Windows
 MSVCR90.DLL is required PHP < 7.2 encoders. This lib is missed in new Windows. Install from Microsoft.
 
https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2008-vc-90-sp1-no-longer-supported

18. must be of type int, float given
If running a test returns "must be of type int, float given" SourceGuardian encoder converts any integers greater than 2^31 to floats for compatibility with 32-bit system and loaders. Otherwise you'd have to encode separately for 32-bit and 64-bit system your clients might use because of different bytecode. Normally, this does not cause any issues when running the code.

If your code uses very large integer calculations and losing precision, consider using specific libs for this instead - this is what you'd do for 32-bit systems.

You may ignore this error on running your tests, remove type declaration (the easiest) and let PHP work on the internal type, or change the test.

19. Call to a member function bindTo() on null (mostly with Laravel)
The following error may occur when using Laravel\SerializableClosure or Laravel itself after encoding some files.
 
'Fatal error: Uncaught Error: Call to a member function bindTo() on null'
 
The error occurs when there is an attempt of serializing and then unserializing of the encoded closure loaded from the same or another encoded file. Obviously, this will not work. It's not possible to serialize any encoded code and any attempts of doing this must be excluded from the project or Laravel code itself.

Laravel framework files must not be encoded since no reason - they are open source. As for your project files, please check which files you need to exclude from the encoding process to eliminate this problem.
 
Also there may be issues with the routes defined as this:

Route::get('/', function () {
return response('Title', 200);
});

You may try to change them to this in order to resolve the issue with Laravel
 
Route::get('/', [Controllers\HomeController::class, 'index']);
 
where's the index function in HomeController
public function index()
{
return 'text';
}

20. For security reasons this protected script cannot run in the current PHP environment. Please contact the author of the script regarding this problem. Error code [16]
SourceGuardian Loader - For security reasons this protected script cannot run in the current PHP environment. Please contact the author of the script regarding this problem. Error code [16]

Usually, this error means you need to disable xdebug PHP extension since it is disallowed and can't be used along with SourceGuardian encoded files in production. If you still get this error with xdebug disabled, please contact support

21. Call to undefined function func_name()
Rarely you may get this in runtime from SourceGuardian loader for the code which refers to a standard function during encoding if the function is disabled or not available in runtime even if this function is not really called. This is related only to PHP8.2+

php.ini: disabled_functions=system
 
if (0) {
  system('ls');
}
 
The above code will be encoded without problems. According to the source, system() will never be called. Neverthless, if system() is disabled in runtime, you will get "Call to undefined function system()" error from SourceGuardian loader trying to run the encoded file containing the above code fragment. 

A reason for that is that PHP8.2+ uses an assertion vs dynamic checking in runtime. Hence, to make the encoding work with a function which is defined later in the code, we have to check for existence of it during loading of the bytecode. Loading is not running though, and there is no assumption if the call will be ever made or not like in the case of if(0).

You are getting this error because of that, i.e. because PHP8.2 uses optimised bytecode for known functions and we do not want to change it to less optimised true dynamic version and follow what PHP8.2 does. It does not know at the compile/encoding stage if the function will be disabled when running the code or not.

A workaround is simple - make it always dynamic.

if (0) {
  $func = 'system';
  $func('ls');
}
 
Obviously if (0) is shown here for demo purposes. It may be if (MYDEBUG) or similar in your code.

The problem does not appear for any custom functions since PHP8.2+ uses different approach for making calls in this case.
 
 
 

php encoder Buy Now

 
BUY NOW

Take a Tour!

Check out the features and benefits of SourceGuardian
Find out more
Try our free php source code demo
TRY SOURCEGUARDIAN FREE FOR 14 DAYS
Account Login:

login Forgotten Password?
Connect with us
Bookmark
facebook linkedin twitter rss
© Copyright 2002 - 2024 SourceGuardian Limited
Privacy Policy l Terms & Conditions l Company Info l Contact us l Sitemap l PHP Weekly News