accssing blob storage by php - php

I am not a php developer and it is my first time working with php. I am assigned to a project to move it to Windows Azure. the application is php ( I think it is old php because there is no classes or objects). I am going to use Blob storage to save uploaded files. I have read a a lot of articles regarding php and WA.
PHP has been installed by using a web role and Platform installer. the application works and communicate with sql azure. but when I follow this article
http://blogs.msdn.com/b/silverlining/archive/2012/07/18/new-connection-pattern-in-the-php-client-libraries-for-windows-azure.aspx
it renders 500 error. I am mistaking maybe old php is not compatible with object oriented php.
thanks for your advice.

Related

Template Designer and Generation Engine for data-driven PDF documents

I have used crystal reports and adobe livecycle for designing PDF templates and generating PDF documents from dynamic data, mainly using microsoft technologies.
I am now looking for the same type of features for linux and php, preferably with open source technologies. The designer can be either an application for linux or windows, a desktop application or a web based app, but the engine should be called from php (ideally from the same server) for generating documents and populating data, all in a linux environment.
Does anyone use anything like this and can suggest alternatives?
Thank you.
I have found a solution for this, so I will leave it here in case someone else is looking for anything similar.
I am using Apache FOP as the PDF generator. I have Apache Tomcat with FOP as a webapp installed on a server, I call it locally through PHP and am able to retrieve the PDF for the templates I need.
The designer I used for testing this was Altova StyleVision, but will take a look at Nimbus, as I usually prefer cloud solutions as they do not rely on the device I am using.
Thank you kevin for the suggestion.

ColdFusion and PHP in same Flex application

I am working on a web application in Flex.
I have already used PHP as a "Flex Server", but now I need to add a mailing service and it seems that ColdFusion is the perfect tool for it.
I don't want to waste time and rewrite all the PHP services to ColdFusion, so I am wondering if it is possible to have PHP and ColdFusion in the same web app.
In the project properties for Flex Server I can only choose PHP or ColdFusion but not both.
Can I somehow manually connect to ColdFusion?
In the project properties for Flex Server I can only choose PHP or
ColdFusion but not both. Can I somehow manually connect to ColdFusion?
The Flex Server option is really meaningless in Flash Builder. I think it helps Flash Builder find the services-config file. I always leave it blank or select none and manually specify the services config file as a compiler argument.
I assume you are using AMF / Flash Remoting; is that correct? You can find the services-config file that is currently being compiled into your app and modify it to add a new destination for ColdFusion services. You may want to combine your current services-config file with the one that comes with ColdFusion.
You should look for the CF Serivces-config file in a directory similar to this:
C:\JavaServer\servers\CFInstanceName\cfusion.ear\cfusion.war\WEB-INF\flex
It'll be slightly different if you're using the standard edition of ColdFusion instead of the multi server edition. I'm not sure where to find the PHP config file; but the two files should be very similar.
Of course, I assume that PHP can also send email relatively easily and I'm not sure the short-term gains of building this will outweigh the long term headaches of dealing with two technologies side by side.

Using PHP to PUT messages on an Azure Queue, and add content to Blob Storage

I was just given the task of PUTTING messages onto a Azure message queue with PHP. Given that I'm new to PHP (brand new) - does anyone know of any resources I can use to get rolling with this?
I also have to add data to blob storage within Azure using PHP. I'm assuming I can do this with standard connection strings and IO, right?
If anyone has any pointers I would really appreciate it. Thanks for your time,
Your easy track here is to use the Windows Azure SDK for PHP.
THis project is co-funded by Microsoft butis comunity led by one of my fellow MVPs.
http://phpazure.codeplex.com/
It provides not only the tooling to run PHP on Azure but also the client library wrappers you'll want to connect to Azure storage. The Storage APIs are pretty accesible if you want to roll your own REST service calls, but, this makes things simple for you.
It should be as simple as calling the putBlob method. The SDK will wrap up all the complexity of block based upload for large blobs.
$image = $blob->putBlob(<container>, <blob name>, <local file path>);
In June 2012, a new Windows Azure SDK for PHP was introduced, and is available on github. You can also visit the Windows Azure Developer Portal for PHP and download the installer, rather than source. The readme has examples for queues, blobs, and tables.
For getting started with the new PHP SDK, I'd suggest taking a look at the Windows Azure Training Kit. Af of the June 2012 edition, there are now PHP examples. None with storage yet, but they show how to set up your project, publish it, etc.
Going forward, this is the officially-supported SDK for PHP from Microsoft.

Convert PHP-MySQL web application to desktop app (exe)

I have developed a PHP-MySQL web application, which is a school-based project.
My client wants this application to be converted into a .exe file such that it can be installed on his desktop and use it.
How the PHP website can be converted to a .exe file and can it be run without the need of a database/server software?
Please advice.
The convenient solution is not to convert the website to .exe. I think it will be better if you have portable server/php/mysql and make the website work from a usb or CD with autorun.
NuSphere's PhpDock claims to do this: It serves as a deployment helper and comes with a bundled web server. However, I don't know about the database part, and it's not free.
PhpDock enables you to deploy any PHP web application as a Stand Alone Windows Desktop application w/o any changes in the code.
I don't know that particular product, but I have been using their IDE for years and am quite happy.
try using a site-specific browser. it will make a desktop app that is basically a portal running to your webapp. try this one:
https://mozillalabs.com/prism/
It allows alot of advanced features like system tray icons and such. I have used it many times!
Hope this helps, JL
Short answer: Not possible.
Long answer: It depends.
You could install a web- and database server on his machine (or create an installer that does it) and run the application locally on his machine.
or
You keep the application on a server and just provide a launcher that opens his browser and points it to the URL of the application.
As Artefacto mentioned, it might be a good idea to switch to SQLite instead of MySQL but depending on how your application is written it might require a lot of code and SQL Query changes.
No. You have at least to remove the dependency on MySQL (and use e.g. sqlite instead).
Then, you would either have to:
Convert the webpages to windows dialogs. This would completely change your application (e.g. what would originally be http "form submissions" would be someting completely different). At this point, it'd much easier to write a .NET application
Bundle a web server (e.g. Apache) with PHP installed.
Another try would be to turn your php project into PHP-GTK (http://gtk.php.net/).
Yet another one is to give HPHP a try (https://github.com/facebook/hiphop-php/wiki/) and try to turn the generated C code into something like a .DLL in .NET and use it for the logic while coding the UI in say, C#.
Just create a simple program in C or C++ that will just add icon in Start menu, desktop and Quickstart. If your client clicks the icon it will open the default OS browser and point it to URI of your application online.
That might fool your client :)
Or maybe it will be enough for him (he might be asking you to convert it to exe because he can't remember URI or something - ask him what is the reason).
You can use xampp open-source project to pack your PHP site into an executable file.
Use the following steps:-
1. Download Xampp source code.
Add your PHP file inside htdocs directory(Ref:- https://sourceforge.net/p/xampp/code/HEAD/tree/win32/xampp/htdocs/).
Now compile the XAMPP source code and distribute it.
For DATABASE creation and initial data loading in the database, you can code your site in such way that if database is not created, it redirects the page to install.php which do the database creation and data loading task using sql file provided(you need to add SQL file containing database structure and required data).
Don't forget to delete the SQL file post installation of database.
Not sure that's gonna be possible but have a look at:
WinBinder
WinBinder is a new open source
extension for PHP, the script
programming language. It allows PHP
programmers to easily build native
Windows applications.
(source: winbinder.org)
Solution 1:
There are several solutions to convert your web application into a desktop application, the one I prefer is the open source solution: PhpDesktop, but unfortunately it only supports SQLite.
Best Solution:
To convert your PHP application with MySQL I know a paid solution that does this: 'ExeOutPut For Desktop', it is the best for this job
Php desktop is the way to go, it's actually very simple to modify to the version of PHP you want to use and is open source too https://github.com/cztomczak/phpdesktop

Transform my Flex application into Adobe Air. Running a PHP in Air

I'm a newbby in Adobe AIR/Flex.
I have developed a simple Flex web app. that through 2 Php's, can connect to a DB and return an XML result of the query. I uploaded the PHP and Flex files to my internet server, and the app. works fine.
My question is:
How can I make the same app. work in Adobe AIR? In other words, I have made a new AIR project, and I copy/paste the Flex code. When I run the project, it does not work and say things like:
[RPC Fault faultString="Error #2070: Security sandbox violation: caller cannot access Stage owned by ." faultCode="Client.CouldNotDecode" faultDetail="null"]
at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:851]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:188]
at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:403]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
So I think that in my AIR app. I cant write HTTP services. Or maybe I cant use the php file that connects to the DB, makes the query and then return an XML.
How can I transform the Flex app. in an AIR app. Do I have to use the SQLConnect and that stuff? Cant I use my php's files that work well?
Thanks.
My regards.
Alan
You can write AIR applications that connect to your PHP, I use coldfusion and java so not exactly sure what differences there will be but should be none on the server side.
The AIR application will require access, or compiled with, the services-config.xml and the three files it includes. For my AIR apps it seemed like the "includes" in the servies-config.xml file did not work and I had to copy the contents of those three files into the main file.
On the compile line you will require something like:
-services "C:\Blazeds\tomcat\webapps\chat\WEB-INF\flex\services-config.xml"
(sorry, I develop on a windows machine), but you will require the full path to your actual services-config.xml file. That line is in my Additional Compiler Arguments with my locale option.
This also requires you to create the project with a server side option.
You might want to also look at moving the code into a separate project, and then have both your AIR and web app use that third project with the code. Then one change in the code can affect both version, of course that means everything would have to be recompiled.
PS. I found the Adobe AIR Programming Unleashed to be a good book for this information.

Categories