2. Install PHP using following commands:
3. To verify if PHP is installed, run the following command:
4. Start Apache2 using following command:
5. You can skip this step. This step is only needed in case if you want to fix and recompile the source code of WSQ PHP extension using Linux GNU C compiler. Download PHP 4/5/7 source code of "WSQ PHP extension" by clicking here Compile WSQ PHP extension using following command:
(file "build_wsq_php_extension.sh" is located inside directory "WSQ_PHP_extension_Linux")
6. Copy file "wsq.ini" to directories:
(for online website usage)
(for execution of PHP scripts using command line)
The contents of "wsq.ini" file is one line only:
7. In case of 64-bit Linux copy file "libWSQ_library64.so" from subdirectory "Linux64" to directory:
In case of 32-bit Linux copy file "libWSQ_library.so" from subdirectory "Linux32" to directory:
8. Copy *.php files to default root folder of the web server. The default document root for Apache is
Copy "phpinfo.php" file to default root folder of the web server.
9. Find IP address for the apache2 server. This command prints both IPv4 and IPv6 address of the currently active interface:
10. In web browser run "phpinfo.php" script using IP address for the apache2 server. As for example:
which shows you PHP configuration of your server, like for example:
11. In PHP configuration table find the current value of:
As for example, "extension_dir" might be:
12. Copy file "wsq.so" from subdirectory: "Linux32" or "Linux64" (or from subdirectory "PHP_extension_PHP_7_0_33/modules" if recompiling the source code of WSQ PHP extension) to "extension_dir" directory
13. Restart Apache2 using following command:
sudo systemctl restart apache2.service
14. Running PHP script from the command line. To parse PHP script file and output to console: php -f file.php As for example:
15. Running PHP script from web browser. Use IP address of the apache2 server and add php filename: As for example:
PHP 5 version (Linux)
Below are instructions for Ubuntu 12.04.5 running PHP 5.3.10.
1. Install LAMP (Linux Apache MySQL PHP) with following commands:
This one line command tells Ubuntu to install lamp-server and phpmyadmin ( ^ means using tasksel), lamp-server is a set of applications to fully install apache, MySQL and php and set it up.
2. Install PHP using following commands:
3. To verify if PHP is installed, run the following command:
4. Start Apache2 using following command:
5. You can skip this step. This step is only needed in case if you want to fix and recompile the source code of WSQ PHP extension using Linux GNU C compiler. Download PHP 4/5/7 source code of "WSQ PHP extension" by clicking here Compile WSQ PHP extension using following command:
(file "build_wsq_php_extension.sh" is located inside directory "WSQ_PHP_extension_Linux")
6. Copy file "wsq.ini" to directories: (for online website usage)
(for execution of PHP scripts using command line)
The contents of "wsq.ini" file is one line only:
7. In case of 64-bit Linux copy file "libWSQ_library64.so" from subdirectory "Linux64" to directory:
In case of 32-bit Linux copy file "libWSQ_library.so" from subdirectory "Linux32" to directory:
8. Copy *.php files to default root folder of the web server. The default document root for Apache is
Copy "phpinfo.php" file to default root folder of the web server.
9. Find IP address for the apache2 server. This command prints both IPv4 and IPv6 address of the currently active interface:
10. In web browser run "phpinfo.php" script using IP address for the apache2 server. As for example:
which shows you PHP configuration of your server, like for example:
11. In PHP configuration table find the current value of:
As for example, "extension_dir" might be:
12. Copy file "wsq.so" from subdirectory: "Linux32" or "Linux64" (or from subdirectory "WSQ_PHP_extension_Linux/modules" if recompiling the source code of WSQ PHP extension) to "extension_dir" directory
13. Restart Apache2 using following command:
sudo systemctl restart apache2.service
14. Running PHP script from the command line. To parse PHP script file and output to console: php -f file.php As for example:
15. Running PHP script from web browser. Use IP address of the apache2 server and add php filename: As for example:
PHP 4 version (Linux)
Below are instructions for Ubuntu 12.04.5 running PHP 4.4.9.
1. Install Apache with following command:
2. Install PHP4 with following commands:
3. To verify if PHP is installed, run the following command:
4. Start Apache2 using following command:
5. You can skip this step. This step is only needed in case if you want to fix and recompile the source code of WSQ PHP extension using Linux GNU C compiler. Download PHP 4/5/7 source code of "WSQ PHP extension" by clicking here You may need to install autoconf.
Compile WSQ PHP extension using following command:
(file "build_wsq_php_extension.sh" is located inside directory "WSQ_PHP_extension_Linux")
6. Setup your php.ini file:
Edit in /usr/local/lib/php.ini
7. In case of 64-bit Linux copy file "libWSQ_library64.so" from subdirectory "Linux64" to directory:
In case of 32-bit Linux copy file "libWSQ_library.so" from subdirectory "Linux32" to directory:
8. Copy *.php files to default root folder of the web server. The default document root for Apache is
Copy "phpinfo.php" file to default root folder of the web server.
9. Find IP address for the apache2 server. This command prints both IPv4 and IPv6 address of the currently active interface:
10. Find the location of the currently loaded php.ini file using following command:
or alternatively: In web browser run "phpinfo.php" script using IP address for the apache2 server. As for example:
which shows you PHP configuration of your server, like for example:
11. Find extension_dir location using following command:
or alternatively: In PHP configuration table find the current value of:
As for example, "extension_dir" might be:
12. Copy file "wsq.so" from subdirectory: "Linux32" or "Linux64" (or from subdirectory "WSQ_PHP_extension_Linux/modules" if recompiling the source code of WSQ PHP extension) to "extension_dir" directory
13. Restart Apache2 using following command:
sudo /etc/init.d/apache2 restart
14. Running PHP script from the command line. To parse PHP script file and output to console: php -f file.php As for example:
15. Running PHP script from web browser. Use IP address of the apache2 server and add php filename: As for example:
PHP 7 version (Windows) Below are instructions for Windows 10 (64-bit) running PHP 7.2.16 and Visual Studio 2017. Your system might need slight modifications of these instructions. To build PHP extension on Windows you will need: (1) Download PHP 4/5/7 source code of "WSQ PHP extension" by clicking here. (2) Microsoft Visual C++ compiler. https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 PHP officially supports building with Microsoft's Visual C++ compilers. MinGW and Cygwin are NOT supported. ICC and clang can be used for experimental purposes. Though, be aware, the production quality binaries are guaranteed only by using Visual C++. The freely available Community VC++ editions are fully supported and can be used. The following VC++ versions are supported: Visual C++ 14.0 (Visual Studio 2015) for PHP 7.0 or PHP 7.1. Visual C++ 15.0 (Visual Studio 2017) for PHP 7.2 or PHP 7.3. For more information and how to get the compiler see the supported versions. https://wiki.php.net/internals/windows/compiler Supported compilers to build PHP on Windows (3) PHP source code, which you can download from: http://windows.php.net/download/ (4) latest stable SDK binary tools, which you can download from: https://github.com/Microsoft/php-sdk-binary-tools https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 Please download and extract the file to directory:
In order to compile PHP extension, you will need:
1. https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 Invoke the starter script to automatically setup the environment for the desired build config, as for example:
2. Change current directory to PHP source code directory:
3. Setup directory of PHP modules using the following command:
"C:\PHP\" is the directory where source code of PHP extensions is located.
4. Run the following command:
By default, this it creates a “Thread Safe” build. If you want a non thread safe build, just add --disable-zts to the command line.
5. To build, run the following command:
This will build WSQ PHP extension, as well as php.exe. This is handy because you’ll need a php.exe that matches the configuration of your extension. In order to be loaded in PHP, your extension must match the PHP build in term of: --word size (32 or 64 bits) --thread safety (TS build or NTS build) --compiler version (VS9, VS11 etc.)
If you don’t need to build php.exe, then you can use following command to compile only WSQ PHP extension:
The compiled WSQ PHP extension will be located like this:
In order to run PHP extension, you will need:
6. Copy "php.ini" file to
7. Add php.exe location to PATH like this:
8. Copy files "WSQ_library64.dll" and/or "WSQ_library.dll" to PATH. As for example, copy files "WSQ_library64.dll" and/or "WSQ_library.dll" to:
9. Check PHP version with the following command:
Check the location of PHP extensions using the following command:
10. Copy "php_wsq.dll" file from:
to:
Otherwise you will get error message like this:
11. Running PHP script from the command line. To parse PHP script file and output to console:
As for example:
12. Starts built-in web server. Available as of PHP 5.4.0.
Enter in web browser:
13. Running PHP script from web browser. Use IP address of the apache2 server and add php filename: As for example:
Additional helpful info:
https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2
https://blog.benoitblanchon.fr/build-php-extension-on-windows/ [PHP] Compile an extension on Windows 20 January 2015
PHP 5 version (Windows) Below are instructions for Windows 7 (64-bit) running PHP 5.6.40 and Visual Studio 2012. Your system might need slight modifications of these instructions. To build PHP extension on Windows you will need: (1) Download PHP 4/5/7 source code of "WSQ PHP extension" by clicking here. (2) Microsoft Visual C++ compiler. https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 PHP officially supports building with Microsoft's Visual C++ compilers. MinGW and Cygwin are NOT supported. ICC and clang can be used for experimental purposes. Though, be aware, the production quality binaries are guaranteed only by using Visual C++. The freely available Community VC++ editions are fully supported and can be used. For more information and how to get the compiler see the supported versions. https://wiki.php.net/internals/windows/compiler Supported compilers to build PHP on Windows Visual C++ 11 (2012) for PHP 5.6.x (3) PHP source code, which you can download from: https://windows.php.net/downloads/releases/archives/php-5.6.40-src.zip Please download and extract the file to directory:
In order to compile PHP extension, you will need:
1. Download PHP 5.6.40 source code from the address: https://windows.php.net/downloads/releases/archives/php-5.6.40-src.zip
2. Copy files extracted from file to directory
3. Download bison.exe file from the address: Download flex.exe file from the address: Download gnuwin32 from the address: Download Regex for Windows from the address: Open archive files and go into their "bin" subdirectories. Copy file "flex.exe" from "flex-2.5.4a-1-bin\bin" into "C:\php-5.6.40-src\" Copy files "libiconv2.dll" and "libintl3.dll" from "make-3.81-dep\bin" into "C:\php-5.6.40-src\" Copy file "regex2.dll" from "regex-2.7-bin\bin" into "C:\php-5.6.40-src\" Copy files "bison.exe" and "m4.exe" and "yacc" from "bison-2.4.1-bin\bin" into "C:\php-5.6.40-src\" Copy subdirectory "share" from "bison-2.4.1-bin\share\ to directory
4. Please use 5. Add php.exe location to PATH like this:
6.
7. Run the buildconf.bat file with the --force argument:
This will generate a new configure.bat file which will have the configuration of your PHP build.
8. Run configure.bat with the following command and enable WSQ extension using the --enable- In our case, the extension is WSQ and the source code is in the "C:\php-5.6.40-src\ext\wsq" directory.
Run the command to configure it:
By default, this it creates a “Thread Safe” build. If you want a non thread safe build, just add --disable-zts to the command line.
9.
To build, run the following command:
This will build WSQ PHP extension, as well as php.exe.
This is handy because you’ll need a php.exe that matches the configuration of your extension.
In order to be loaded in PHP, your extension must match the PHP build in term of:
--word size (32 or 64 bits)
--thread safety (TS build or NTS build)
--compiler version (VS9, VS11 etc.)
The compiled WSQ PHP extension will be located like this:
In order to run PHP extension, you will need:
10.
Copy "php.ini" file to
11.
Add php.exe location to PATH like this:
12.
Copy files "WSQ_library64.dll" and/or "WSQ_library.dll" to PATH.
As for example, copy files "WSQ_library64.dll" and/or "WSQ_library.dll" to:
13.
Check PHP version with the following command:
Check the location of PHP extensions using the following command:
14.
Copy "php_wsq.dll" file from:
to:
Otherwise you will get error message like this:
15.
Go to sample project directory:
16.
Running PHP script from the command line.
To parse PHP script file and output to console:
As for example:
17.
Starts built-in web server. Available as of PHP 5.4.0.
Enter in web browser:
18.
Running PHP script from web browser.
Use IP address of the apache2 server and add php filename:
As for example:
Additional helpful info:
https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2
https://blog.benoitblanchon.fr/build-php-extension-on-windows/
[PHP] Compile an extension on Windows
20 January 2015
Names of the functions in "PHP extension" are slightly different from names in WSQ image library.
They are listed in the table below.
Table 1 Names of PHP functions in "PHP extension"
For more details about how to use PHP functions please see the files
in Linux PHP 4/5/7 sample project
in Windows PHP 4/5/7 sample project
Please do not forget to set file permissions for *.php and *.so files.
|
|
Copyright © 2023 Cognaxon. All rights reserved. Privacy |