So I have created a www site on my private server. It's basically a PHP + javascript page. Now I need to move it to BlueMix. The only problem is that while I used a MySQL db on my private server now I need to use SQL Database-s2 and all (both my php page and the db) on BlueMix.
Mike
You can deploy your application on Bluemix using the PHP buildpack. After creating the SQL Database instance and binding it to the PHP application on Bluemix, to connect to the SQLDB service in Bluemix you can use db2_connect with the credentials retrieved from the VCAP_SERVICES environment variable. I don't know your business requirements, however if you want to keep consistency across the environments and don't want to migrate to another RDBMS you could try ClearDB, that is a reliable, fault tolerant, geo-distributed database-as-a-service for your MySQL powered applications.
You have to parse db information from VCAP_SERVICES\service credentials.
If your database service is "SQL Database" you can connect to SQLDB using this example code:
the information is automatically retrieved from the VCAP_SERVICES. The application read the env. variable and retrieves automatically the username,host,db password field.
but you can manually set db, host, port, username, password looking at service credentials of the service:
How to retrieve credentials information:
from DASHBOARD UI
from CF command line
cf env your_app_name
In the code we are using DB2 module: use the following buildpack https://github.com/ibmdb/db2heroku-buildpack-php when you are using SQLDB with PHP. It will install the 'ibm_db2' php module for your use.
You can set the buildpack when you push your application on Bluemix: