Is it possible to read locally available Foxpro files (.DBF) from a PHP script hosted on a Linux server?
Please suggest anything that doesn't depend on Windows or Java.
php has an extension for reading dbf files: http://www.php.net/manual/en/book.dbase.php
Various utilities are available for dumping DBF data to CSV and similar formats, E.g.: http://linux.die.net/man/1/dbfdump .
Or you can invoke Open Office base (in headless mode) to convert data to CSV.
Related
My setup: IIS 7.5, PHP 5.4, Windows 7
I've trying to create a COM Object through PHP but I continue to get access denied. I've also followed a handful of tutorials on how to "grant access" to the ISUR to create the object but to no avail. I read the installation portion relevant to COM interfacing that says:
As of PHP 5.3.15 / 5.4.5, this extension requires php_com_dotnet.dll
to be enabled inside of php.ini in order to use these functions.
Previous versions of PHP enabled these extensions by default.
You are responsible for installing support for the various COM objects
that you intend to use (such as MS Word); we don't and can't bundle
all of those with PHP.
I've enabled the php_com_dotnet.dll file within the ini file but I still can't seem to create the COM object for Excel. Then if you read the second paragraph it says that you have to install support for the various COM objects you intend to use but doesn't specify how to go about doing that.
Question: How do I install support for the MS Excel COM object?
Any help would be appreciated. I've researched this issue but haven't found very much documentation out there.
Don't do this. You're in for a world of pain trying to launch Excel in a web application, especially from PHP.
Microsoft Office apps such as Word and Excel are not designed for server side use. When you try to instantiate an Excel "COM object" you're spinning up a full instance of Excel as a separate process. That is hugely expensive and will never scale. Not only that, to add to your woes, if for whatever reason your script can't release and shut down Excel you'll end up with tens or possibly hundreds of orphaned Excel processes hanging around in memory.
Try something like: https://github.com/PHPOffice/PHPExcel if you need to read and write Excel compatible spreadsheets.
How can i read formatted text as HTML from doc, docs and rtf files?
My script is on LAMP, can access openoffice installed on server for this type of conversion?
EDIT
Its not necessary that i want to access openoffice through a php extension or Apache module, if it is possible to use it using cli trhoug php, it would be fine too.
You can try Puno: http://www.wstech2.net/index.php?do=0a,01,05
This project is a PHP5 module written in C++ that brings the OpenOffice.org UNO Programming API to the PHP userspace.
It uses UNO Reflection API by OpenOffice for it. It's easy to start with. Check out sample example given there.
I develop webapp with PHP5 to read or to actualize xlsm files.
I have tried with PHPEXCEL, but this library not supported xlsm-files format.
Everything what I need, is open the file, write the data in there and stores as a xlsm-file.
The macro should not be changed.
It is important that the file returns which contains the macros because this file it is used daily to do several import. I may not change the file-format.
if somebody has tips or tutor's courses for this specific task has, please writes to me.
Thanks 4 your help
If you need to retain macros from an Excel template, then you'll need to use something like COM because there aren't any other libraries that handle macros from PHP
xslm files are actually ZIP files with XML documents and other assets inside them. PHPEXCEL and other similar MS Office file format readers and writers only read the older binary-blob formats, not the newer Office Open XML formats.
Try using ZipArchive to open the file in PHP, and one of the PHP XML libraries to read the xml inside the file. As long as you don't alter the macros, the macros will be preserved.
However, if you actually need to execute the macros, you need a full Office runtime. In this case you must use COM on windows with a copy of Office to run the file.
Is it possible to write .MDF files using PHP. I have a simple HTML table - x columns, y rows that I wish to convert into a MS Access dataset. There are no foreign keys or anything exotic, just a number of rows and columns.
I have Google searched but the only advice I seem to be able to find is to save it as a .CSV. Unfortunately this isn't acceptable for my client. They want to simply be able to double click the icon and have the database load up in Access (Seems you have to import csv files and can't just double click them).
Those are actually two different problems:
1) Parsing HTML to separate values
Since you seem to have found a way to export to csv, I won't be answering this. You already got your parser then.
2) Create an mdb file.
You can use odbc to talk to Access, that is, if you are in Windows. That means that PHP must be installed on a Windows machine. I'm not aware of any Linux drivers for Access..
You can use odbc_connect to connect to the database:
$conn = odbc_connect("dbname","" ,"");
From there, working with the database is pretty similar to MySQL as long as you use the ODBC functions.
The only problem is creating the actual MDB. This cannot be done in ODBC, you'll need the JET engine. It may be possible to create an MDB file from PHP, but it may be easier to create an empty MDB once, and copy that file from PHP whenever you need a new database.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.
http://jackcess.sourceforge.net/
But an MDF file is not a standard Access file extension. MDB and MDE are while MDW is for user level security.
Have not tested this but this might help you:
http://devzone.zend.com/article/4065
Note that active development of MDB Tools has moved from Sourceforge to Github
https://github.com/brianb/mdbtools
I use a local installation of Apache, MySQL, and PHP with XAMPP which require a bit of configuration and installation - is there an alternative language or database system that can be used on portable media such as a CD or DVD-Rom? Although this question is similar to apache-php-and-mysql-portable - I'm looking more for the best portable alternative.
Some thoughts I've had so far are:
Database: data can be stored in csv, txt files, xml, json or xls and accessed via javascript. This would at least allow for reading of data. Is there a simple way of writing to a installation data directory or at least system temporary location?
PHP: Not sure of an alternative but a "server-side" language would help with complex functions.
Otherwise if it's a CD or DVD could part of the installation of the "app" include a PHP/MySQL installation (or equivalent) in a temporary location?
Couldn't you create a LIVE CD/DVD(media) w/an OS that has the stack you need, all pre-configured?
If you jailbreak an iPhone, you can run many popular *nix tools, including web servers. I'm not sure if PHP is ported yet, but it could easily be.
Not necessarily on the iPhone, but you can also use an iPhone as a virtual USB key if you are jailbroken.