How to connect to mysql on a BlueMix PHP app - ibm-cloud

What directive do I need to include to have the mysqli library available to my php app on BlueMix?

You need to add the following to your composer.json file:
"require": {
"ext-mysqli": "*"
}
I suggest you to take also a look at this sample.

Related

Integrate Paypal PHP sdk with Cakephp 3.x

To use Paypal PHP SDK is quite simple but when i try to use this SDK in cakephp 3.x then it generates errors. I changed namespace name in "Paypal SDK project" to bring all files under one name space.
My cakephp project namespace name is
namespace App
but namespace in Paypal SDK is
namespace PayPal
I just changed it to "namespace App" and put all files in PayPal folder and put that folder in "src" folder in cakephp project. but PayPal does not work using this technique.
Can you please advise me how to use this SDK in CakePHP or where to put files are best.
I know there are some other techniques to make payment via paypal without SDK but i want to use SDK.
Can you please guide me little bit how to integrate PayPal PHP SDK in CakePHP.
SDK is provided here
https://github.com/paypal/PayPal-PHP-SDK
some payment samples are here
http://paypal.github.io/PayPal-PHP-SDK/sample/
1. Use composer for installation which will manages the dependencies:
Go to your project directory (Eg:E:\xampp\htdocs\cakephp) in command promot and type following:
composer require "paypal/rest-api-sdk-php:*"
This will install latest version of paypal sdk into the vendor folder,you can go into vendor and check that.
2. Configure your environment:
Make any function for configuration of paypal in any controller you would like:
public function configuration() {
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'YOUR APPLICATION CLIENT ID', // you will get information about client id and secret once you have created test account in paypal sandbox
'YOUR APPLICATION CLIENT SECRET'
)
);
}
As you are using cakephp framework you don't need to write following line into your function as suggested in papal documentation:
// Autoload SDK package for composer based installations
require 'vendor/autoload.php';
This is because you have already done that with autoload.php file within your vendor folder.
3. Using paypal classes:
You need to use paypal classes/namespace within your controller in this way:
namespace App\Controller; // your controller have this already
use App\Controller\AppController; // your controller have this already
use PayPal\Api\Payer;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
4. Completely follow this quick start guide which will be pretty straight forward now:
Paypal quick start guide.
For making sandbox test accounts:(Paypal developer guide)
I recommend using : omnipay
https://packagist.org/packages/omnipay/paypal
or this add to your composer.json
{
"require": {
"omnipay/paypal": "~2.0"
}
then
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
if windows
composer update

Register aws/laravel/sdk in lumen microframwork

I am trying to use the laravel/aws/sdk with lumen all the docs use
a config file which are not used in lumen. How do you register this
sdk in lumen?

How to extend an orientdb embedded server to have my own servlets?

I have created an orientdb embedded server standalone app to which I can query from console. However I need to extend the functionality to publish a page where multiple users can run queries and see (custom) svg visualizations. How can I do this?
I presume I need to create some html pages with servlets and also some orient db javascript libraries. But I am not sure how to connect all these.
Any help is appreciated!
Thanks,
Rao
You can create your pages under OrientDB server's www directory or also create a plugin that is a zip with pages and optionally Java classes. Unzip the studio file under plugins to see how is made.
Look also to how to write plugins.
I just found that required html files placed under the path: "[orientdb app path]/src/site" are accessible through http url. The bold ones are the folders which I created.
This path is looked upon in the OServerCommandGetStaticContent.java which in turn is configured in the config.xml for HTTP requests. I think if you wish you handle the http requests in your own java, you can mention that in the config.xml.
Thank you Luca for your pointer!
Rao

Deploy HTML only app to Heroku?

Can I use Heroku to deploy an HTML prototype?
My HTML prototypes live on Github and Heroku would be a nice way to deploy them so clients can view them.
It seems that this is unsupported, since Heroku expects a Rails/NodeJS/[insert language here] structure or it won't run.
Push rejected, no Cedar-supported app detected
Are there any tricks to circumvent this?
The best solution would be to use a buildpack designed for hosting static content.
I'd suggest the experimental heroku/heroku-buildpack-static buildpack. In brief, just set the buildpack:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-static.git
And add a static.json indicating which directory contains your static assets:
{"root":"public"}
The least effort solution is to rename your default file to index.php and redeploy. Heroku will detect it as a PHP site and use that buildpack.
Alternatively, you can follow this guide https://devcenter.heroku.com/articles/static-sites-ruby to set up a sinatra app to host it.
I've not done it before but since you mentioned using github. Why not use Github Pages to show the prototype.
You can always use an nginx buildpack to run nginx on heroku:
https://github.com/neilmiddleton/heroku-buildpack-nginx
I've used it with great success to handle a large batch of complex redirects and act as a reverse proxy to a new heroku app for an old, defunct application. Here's a simple config example that will get a static site up and running: https://gist.github.com/leklund/5877422.

How to deploy a Zend Framework app on Heroku?

Basically for a Facebook tab I have a PHP app and want Heroku to use the 'public' folder as the web server's root folder instead of pointing to the very root of the app. Any help would be awesome as it seems Heroku doesn't have a ton of documentation around it's config options. Thank you.
I hosted my php codeigniter project on heroku lastmonth, so unless there is a server side configuration needed for your project. You should be able to host your zend project by pushing it as git repository to heroku. Just follow these tutorials.
http://www.youtube.com/watch?v=L2YlEIMrGxA
https://devcenter.heroku.com/articles/facebook
Not sure of that but Heroku's website says "Agile deployment for Ruby, Node.js, Clojure, Java, Python, and Scala.". But since there's no mention of PHP I think you can't deploy your Zend app on Heroku.
EDIT : my assertion was false, see comments
Thats not entirely correct (or no longer correct) - if you put a repository with an index.php in the root up it seems to recognise that as a php app.
The answer is not yet at least. They only offer the Facebook app hosting. I have gone with PHPFog for quick PHP hosting now.
EDIT: PHPFog is no more, now they have AppFog.