I'm working on importing and exporting very high volumes of data from Excel into/out of MySQL via PHP. I have a working solution but it is very memory intensive and slow.
I have seen that a developer has produced a Unix build PHP script incorporating libXL - a very fast C library for excel that costs about $200. This purports to process 10,000 cells in 0.03 secs using 262kb of PHP memory.
I also notice that someone posting on this site is developing a stand alone dll based on libXL which I don't think will be suitable for my purpose.
Questions:
Is anyone out there looking to produce a simple to implement PHP libaray built around libXL which I could deploy on both a local Windows based XAMPP rig and onto my UNIX based host (Hostpapa while I'm developing)
Would I need to buy libXL for both Windows and UNIX to work both locally and on-line
Are there any other PHP solutions which are very fast and have low memory requirements
I have tried every PHP solution suggested by the PHPExcel developer, Mark Baker (thanks Mark), and nothing meets my requirements fully so no suggestions along those lines please.
I am considering learning Perl so I can use the excellent Excel parser that exists but unfortunately I've got time constraints and I think that will take me too long.
I am using libXL for my requirements, which involve parsing large amounts of cells in linux, its well worth the money, and in my opinion none of other PHP Excel solutions can match this coz it is a compiled solution. You can find more info here:
http://www.king-foo.be/2011/05/a-first-attempt-at-the-php-excel-extension/
Related
I've been searching the internet for over 3 days now and cannot find anything that has a clear explanation of how to install ffmpeg for php. I currently have ffmpeg installed correctly on my Mac command line but as to how to use it in my php scripts is beyond me. How do I install ffmpeg for php? Any help would be great. Thanks.
ffmpeg is a set of executable programs and not an API. There was a project I was aware of in the past that built a php extension, but it was not robust and never really emerged as viable for a number of reasons, not the least of which is that ffmpeg has a lot of different options and builds.
Several years ago I was tasked with building an audio and video encoding system for a social network startup, utilizing PHP as the middleware, so I've been through this exact exercise.
One of the most challenging aspects was coming up with a working compiled version of ffmpeg with all the encoders we wanted to have. In our case our hosted environment was AWS and we were using Amazon linux servers, so there were a few hiccups along the way, and patches I had to chase down. There were packages available that had ffmpeg, but they were hopelessly outdated and missing key features we needed. The only way to get things working was to get the ffmpeg source and compile it, along with the source for the various codecs we were using, primarily to get mpeg4 video and compatible audio. If you aren't comfortable doing this, you will probably not be able to get things working.
In regards to the PHP side of it, I ended up using the PHP-FFMpeg library suggested in the comment above, but I did fork it and made a lot of customizations that worked for us, but were not really contributable back upstream. Subsequently, the maintainer of the library has addressed many of the issues I had and it is a much more robust library now that should save you a lot of problems if you were to try and create your own wrapper.
In summary your server needs:
A working compiled version of ffmpeg and its associated helper
programs which may be of need depending on what you're going to be
doing with media you are producing. For example, there is a separate media introspection program (ffprobe) that is used to determine the characteristics of media you want to encode.
A PSR-0/Composer compatible project. Ours was built on top of Symfony 2.x but that isn't a requirement. I did want to mention it as the project has really pushed the improvement and stability of the symfony component that wraps the php 'exec' function at the heart of any effort to call an external program.
Following the instructions and reading through the API you should be able to get a sample encoding to work with PHP, but keep in mind that ffmpeg works with files, and there are lots of file related issues you have to think through (original files, rendered files and naming, temporary file locations) all of which you'll have to deal with unless you're doing something trivial. In our case these programs were async command line/batch oriented and there was a lot of time and effort that needed to go into figuring out a way to scale and be performant. Needless to say, encoding video can take a lot of time, and is not something you want to do in a monolithic php script where the end user uploads and then waits while you do all the processing in the same script!
I know you are trying to do this on your Mac. Is this really the target environment for your production deployment? This is finicky and platform dependent enough of a process that I don't think it's advisable to try and get a hacky version on your Mac, because the process of getting ffmpeg, and the exact version and components is highly variable and extremely important to your success.
I am working on a project which requires me to generate documents as docx and then convert to doc and pdf.
This project is written in PHP (using Zend Framework) and running on IIS on Windows (client requirements - definitely not my choice!).
Windows Server
IIS 7.5
PHP 5.3
OpenOffice 3.2
I am researching the ways in which I can carry out the document conversion (including the LiveDocx service) and am currently looking into using OpenOffice running as a service to convert the documents.
I have a PHP script which works -- it is similar to the code in this post How do I convert RTF to PDF from my PHP web page using OpenOffice? -- but I wanted to know how well this will scale. the PHP script is basically a PHP version of the PyOD converter using PHP's COM functions. On this page (http://code.google.com/p/jodconverter/wiki/GettingStarted) it specifically says that the PyOD script is not intended for to work with multiple concurrent connections. I would therefor assume that the PHP script will be equally unsuitable.
Having read around, it seems that the OpenOffice process which is running will only support one connection at a time. Is this definitely correct? If so then am I right in thinking that it is simply not a viable solution? I would be expecting high usage for the product so concurrent conversions are a must. Does anyone have any experience with this in a production environment?
In finishing, does anyone have any other recommendations for carrying out the conversions? If not, I will go back to using the LiveDocx service. My only real gripes with it were speed and some inaccuracies with the conversions.
Thank you in advance for your help.
You probably can scale OpenOffice to do what you require. Having done work directly with the OpenOffice UNO api in the past, you might find you have a lot of work to do though. Trying to use a single OpenOffice process in a multithreaded-fashion only lead me to grief. You can however spawn several OpenOffice processes and single-thread each. It depends on what your performance criteria are as to whether this is going to be scalable enough...
JODReports and Docmosis sit over OpenOffice so it might be worth trying one of these systems out to see if you could potentitally scale to what you require before investing any development effort yourself with the particular technologies. You might also look at LibreOffice which has evolved a little further recently than OpenOffice.
Hope that helps.
I am building a small web interface to a database that will run on a Pogoplug Pro (128MB RAM). The app is unlikely to ever have more than four or five simultaneous users, and will run with sqlite as the database backend. Is it feasible to use a Lightttpd - PHP combination (with fastcgi) on this system? For other reasons enabling swap is not an option. Or should I try to use more lightweight languages such as Python?
PHP is indeed a memory hog as it allocates memory for all the different types of c variable (int, float, string, boolean etc) for every single variable you declare (Source). I'm not sure about the memory footprints of other languages. But I would suggest looking into HipHop for PHP.
Hiphop is an open source project released by Facebook a couple of years ago that compiles PHP code into highly optimised C++ that runs directly on the underlying OS. Once you hit compile, you get a full web stack with your PHP application bundled into it that runs fast and uses less memory. You can find hiphop at GitHub here. I'm not sure how mature it is, but it's certainly a possibility for your situation :)
Just so you know, I don't work for facebook or hiphop, I just think its a really clever system :)
I'm working on a system that was developed for linux and that needs the Total Memory of the machine and the Free Memory.
For that, the system used the /proc/ folder of linux to get that data, but mac doesn't have that folder.
Two days ago I got bored of running a virtual machine on my computer only to be able to test and started making the program compatible with mac.
Because of that I started evaluating different methods, but none worked.
The most popular answers that you can see on internet if you search for this problem are the following:
free (-bash: free: command not found // It doesn't exist in mac).
Top (I was able to look at the info in the console, but I wasn't able to retrieve it from the code).
But because of the reasons I added between the parenthesis, they are not useful.
How can I get the Total Memory and the Free Memory on a mac computer so that I can use it from a program?
NOTE: I am working on php. If you have a php solution, it will work, but I prefer a general solution.
Here are bunch of answers from apple.stackexchange.com from an exact duplicate of this question, wasn't hard to find from a simple Google search.
The Python solution that uses ps and vmstat could easily be re-written directly in PHP in just about the same amount of lines of code.
There are many solutions included, all the command line ones have outputs that can be parsed.
All the Python and Ruby solutions pretty much explain in plain simple code how to use sysctl and parse it's output to get the free memory. Most of them are single functions or even one liners.
Here is a list of all the Unix command line tools that ship with OSX, you might find something more platform specific, but the free work alike scripts in the above link would be more platform agnostic.
I am looking for a super-light weight open-source database engine (could be a library that mimics one) to be packaged part of a tiny PHP script distributed to people without sudo access. Basic CRUD, no need for any complicated implementations with string search, etc.
I found txtSQL (uses flat files, which I believe is the way to go) but hesitant to use it given the last time it was updated (2005-03).
Suggestions anyone?
sqlite gives you a platform-independent file format and is heavily regression tested and widely used. It is also available in PHP via SQLite3.
sqlite is about as light as you can get and it does everything via text files.