Skip to content

bigjoevtrj/linux-php-barcode-reader-

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Barcode Reader for Linux

The sample demonstrates how to make PHP barcode reader on Ubuntu 16.04 with PHP7 and Dynamsoft Barcode Reader for Linux.

License

Get the trial license.

Installation

  • php7.0-cli, php7.0-dev, libxml2-dev

    sudo apt-get install php7.0-cli php7.0-dev libxml2-dev
    
  • php-7.0.29 source code

  • Dynamsoft Barcode Reader SDK

    tar xzf dbr-linux-6.3.0.tar.gz
    sudo cp Dynamsoft/BarcodeReader6.3/lib/libDynam* /usr/lib
    

How to Build the Extension

  1. Unzip PHP source code and then change directory to ext:

    tar -xzf php-7.0.29.tar.gz
    cd ~/php-7.0.29/ext/
    
  2. Create an extension folder:

    ./ext_skel --extname=dbr
    cd dbr
    
  3. Set a valid SDK license in dbr.c:

    DBR_InitLicense(hBarcode, "t0068NQAAAIY/7KegDlZn7YiPdAj0cbA11n2CwuCEWnk2KYla55ozdfmoasjRIpHhl0EUZmko/zxfxFLH3FpLw694uihoCVM=");
    
  4. Copy config.m4 and dbr.c to ~/php-7.0.29/ext/dbr:

  5. Copy php.ini to /etc/php/7.0/cli/php.ini.

  6. Build and install the extension:

    phpize
    ./configure
    make
    sudo make install
    
  7. Change the input file in reader.php:

    $filename = "/home/xiao/AllSupportedBarcodeTypes.tif";
  8. Run reader.php:

    php -c /etc/php/7.0/cli/php.ini reader.php
    

    php barcode reader

Online Barcode Reader with PHP Custom Extension

Get the source code and deploy it to any web server. php online barcode reader

PHP on Apache

  1. Install php7.0-curl, apache2 and libapache2-mod-php7.0:

    sudo apt-get install php7.0-curl apache2 libapache2-mod-php7.0
    
  2. Add extension to /etc/php/7.0/apache2/php.ini :

    extension=dbr.so
    
  3. Get write permissions:

    sudo chgrp -R www-data /var/www/html/reader
    sudo chmod -R g+rw /var/www/html/reader
    
  4. Start Apache:

    sudo service apache2 start
    #sudo service apache2 stop // if you want to stop Apache
    
  5. Visit http://localhost/reader/index.php.

PHP on Nginx

  1. Install Nginx and php7.0-cgi:

    sudo apt-get install nginx php7.0-cgi
    
  2. Enable PHP in configuration file:

    sudo vi /etc/nginx/sites-available/default
    
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
    
            # With php7.0-cgi alone:
            fastcgi_pass 127.0.0.1:9000;
            # With php7.0-fpm:
            #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
    
  3. Get write permissions:

    sudo chgrp -R www-data /usr/share/nginx/html/reader
    sudo chmod -R g+rw /usr/share/nginx/html/reader
    
  4. Run Nginx and php-cgi:

    sudo nginx
    # sudo nginx –s stop // if you want to stop Nginx
    sudo php-cgi -b 127.0.0.1:9000 -c /etc/php/7.0/cli/php.ini
    
  5. Visit http://localhost/reader/index.php.

Blog

About

Wrap Dynamsoft Barcode Reader C/C++ SDK for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 56.0%
  • JavaScript 31.5%
  • Hack 5.7%
  • CSS 2.7%
  • PHP 2.7%
  • M4 1.4%