OpenCV and Php. Impossible? - php

See, i'm trying to use OpenCV in Php, but i cannot find a proper way to do it. Neither in stackoverflow.
Over the internet, i found two different ways to try:
Using this git. https://github.com/mgdm/OpenCV-for-PHP
Problem: This code uses the dl function to import extensions on real-time execution , which has been removed from the last php versions (5.3 to 5.6 i think)
Solutions i've tried:
Link the extension .so at the php.ini file.
Problem: The code dosen't has any opencv.so file
Downgrade my php 5.6 to 5.2
Problem: Incompatibility with other parts of the code.
Using OpenCV Pecl package. http://pecl.php.net/package/opencv
Problem: The web shows the package but it has "no releases available". Neither if i try to download it on Centos using "(sudo) pecl download opencv". It gives me the same message, "no releases available. Download failed".
The thing is that i've seen a face-detection algorithm done with openCV over php, so i guess it is possible to use this library on Php. Anyone knows how?
Thank you in advance.

OpenCV has only C++ and Python implementation ,and its strictly machine vision library,However if you write "web service" say Json to interact with the machine vision script ,you can then access it via php client request.
image--->'json'--->python facedetect---->image--->'json'---->php

Related

Recompiling PHP, when I've previously installed it with XAMPP

I'm on Windows 10, and I really need to install this PHP extension in order to use advanced GeoPHP methods. I've already asked about this previously here. There is no available DLL for this extension, and the instructions for installation on GitHub are for Linux. What I've understood is that I need to recompile PHP with the extensions in the ext folder, so I'm planning on doing that using these instructions. However, I've previously installed PHP through XAMPP.
My question is, will these instructions work with this? If yes, where can I find the PHP source files? I'm not quite sure what they look like, and googling "PHP source files location" gives me stuff about actual PHP files, not the ones used for installation. I just want to make sure. Thanks.
No, you do not have to recompile PHP. The module you stated is not baked into PHP but dynamically included.
Just build the module and include it like
extension=geos.dll
The Github link you posted does have instructions...

How to compile WSO2 WFS PHP 2.1.0 or where to get latest binaries

I'm having trouble compiling the WSO PHP framework on Windows. The latest version is here on github https://github.com/wso2/wsf. I've been trying to follow the instructions located at /php/README.INSTALL_WIN32
The problem is that the folder structure in github does not match what that build.bat is expecting and the build fails.
I'm having to do this as part of a website running an old version of php is being upgraded to 5.3 and still needs WSF to run.
I can't find the binaries anywhere pre compiled - if someone knows where they are then that would save having to try compiling them. If not, any help in the compile process is appreciated.
Thanks
I ran into the same problem as you except when trying to compile under Linux, I found the solution to be first configure/compiling the C components from the source from here, copying the contents after make into a new folder 'wsf_c' inside the php fodler and then using the build script within the php folder of the sources from Github. I know you've likely found a way around this already but I hope this may help someone.

Installing PDFTK on a shared web server

My web sites are hosted on Total Choice Hosting using some kind of Linux (I don't know what precise variety) and Apache. I don't have command line access - I can run command line programs only via exec() in PHP, or via CRON jobs.
Can I install and use PDFTK on a system like this?
If so, what exactly do I have to do? Which files do I have to copy where? Do I have to rebuild PDFTK from source, or is there an executable version somewhere?
Since (as I understand it) PDFTK is based on iText, which is written in Java. Maybe I'd be better off using the original iText package?
Or is there a better way of doing what I want to do (which is basically to merge and flatten a PDF file (blank form) with a FDF file (field values) into a new PDF file (the completed form) and download it to the user)? Is there some native PHP or Python or Perl code to do this?
Thanks - Rowan
A quick glance reveals that the PDFTK source is C++ and it looks like they use GCJ to compile some 3rd party Java code to native code. If you find a pre-built version of PDFTK that matches your OS and architecture you should be able to just upload the binary to your system and run it from PHP using exec. There are some builds available on the install page.
There are some native PHP libraries available for creating and manipulating PDFs. Check out TCPDF, Zend_Pdf, and FPDF to see if any of those are usable. Each one should support what you want to do, its just a matter of choosing the right solution.
Using PDFTK may be the fastest option since it is compiled code, but it is the least portable option since it would require the server have that software installed on it, where the PHP solutions could be distributed with your code.
If you are on a shared host you cant install PDFtk because you don't have access to root to install anything. You need to have a host that has it preinstalled. I use bluehost.com but there up-time is not the best. It works for now but I am going to move to another host once my site is complete. I have had several outages that have lasted for over a day.

PHP UUID extension DLL file for windows

When i tried to connect to Apache Cassandra server using the php code i got an error "Fatal error: Call to undefined function uuid_make()". I can find that PHP UUID extension was missing in PHP installation. Can anyone please suggest from where i can download the DLL file for PHP installation in my Windows 7 Machine.
Since there's no .dll file for the PHP UUID extension available online... you need to compile it from source. It shouldn't be too hard...
Download it here:
http://pecl.php.net/package/uuid
Follow the instructions here:
http://php.net/manual/en/install.pecl.windows.php
You can also install directly from PECL, instructions here:
http://wiki.php.net/internals/windows/stepbystepbuild
Unfortunately the PECL UUID extension is OS specific and will only work on Linux (including OS X) or Solaris.
On windows you have a couple of alternative options:
Check out com_create_guid (http://php.net/manual/en/function.com-create-guid.php) which is a Windows Only PHP function.
MySQL has a function called UUID (http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html#function_uuid) which will generate a UUID, use something like "SELECT UUID()" as your SQL query. (I have not tested that this is available on Windows builds, if you do use it please post a reply to let everyone know how you got on)
If you are not worried about the uniqueness of your UUID (the reason for a UUID is to be as certain as possible that you won't generate two identical values ever in the lifetime of your application) then you could try some pure PHP implementation. It is not the most desirable solutions and I would never do this in production, but it might be enough for your needs - there are plenty out there on the web to use for inspiration.

How to work with PHP on Windows XP?

I want to do a sample program in PHP on Windows XP.
Do I need any special software to get this to work?
I am afraid that I simply open notepad type the PHP program and save it with php extension. Then I open it with the browser as a HTML file. But it does not work.
Please help
Thanks in advance
However you decide to install a webserver and php (or just php and use it in the console like someone mentioned):
Check out the PHP Manual, especially the Getting Started section.
Apache (Very, very easy)
Check out the WampServer getting started presentation.
Download and install WampServer.
And you are ready to go.
Microsoft (Not tested this myself)
Check out PHP on Windows.
Download and install the Microsoft Web Platform Installer.
Let me know how that work out... (never tried it myself, since WampServer is so easy)
You need to have a web server with PHP installed on your PC to make this work.
I highly recommend installing wampserver on your computer. It is a Windows installer that will put PHP, MySQL and Apache in your computer and let you manage all the services and such very easily. If you have problems getting it to work, you can also try out XAMPP, although I've never used it myself.
Some answers containing the hint for using wamp.
You should better use the Zend Server Community Edition.
This is also free and can be downloaded here:
http://www.zend.com/de/community/zend-server-ce
This contains Apache, Mysql, PHP and some Zend related Tools.
Benefit: its much better preconfigured than wamp.
Another easy one to set up (though it takes extra config to support PHP5) is easyPHP
you can simply install PHP, and then run the program and redirect the output
php foo.php > output.html
and then use any browser to open up that html file.
Since you have IIS on the windows cd I would suggest you go to control panel, install/uninstall programs and click on windows components and install IIS. Then install ASP.NET 3.5 from www.asp.net and finally install Phalanger from http://www.php-compiler.net/
That will give you the benefit of both worlds, you can program in ASP.NET using PHP as the language, you can use only PHP if you prefer that or you can mix using ASP.NET/C# on some pages and PHP on other pages within the same application.
I use XAMPP, works out of the box with his installer and is more than enough for a simple developer windows environment.
The simplest way - use www.microsoft.com/web platform installer. get the whole stack to run PHP all from one place.
i would like to share that before starting PHP we have to set environment for that and then we can start working with PHP.
http://code.freefeast.info/php-tutorials/setting-up-the-environment-for-php-php-tutorial/

Categories