phpFog - Joomla config & environment variables

1,040 views
Skip to first unread message

Adam Wooding

unread,
Oct 14, 2012, 10:06:40 PM10/14/12
to appfog...@googlegroups.com
Hi there,
I'm trying to set up Joomla 3.0 in my phpFog account. In the Joomla configuration file, I have tried to use the getenv() function as suggested within the App Console. However, 

This is how I have tried to implement it in the configuration file:

<?php
class JConfig {
public $dbtype = 'mysqli';
public $host = 'getenv{MYSQL_DB_HOST}';
public $user = 'getenv{MYSQL_USERNAME}';
public $password = 'getenv{MYSQL_PASSWORD}';
public $db = 'getenv{MYSQL_DB_NAME}';
}

Can you please let me know what i'm doing wrong, or if this is even possible to do within the Joomla configuration file?

Thank you very much,
Regards
Adam Wooding

Adam Wooding

unread,
Oct 14, 2012, 10:19:29 PM10/14/12
to appfog...@googlegroups.com
Sorry, I also meant to say that I am getting the following error when trying to view the site:

Error displaying the error page: Application Instantiation Error

Cheers,
Adam Wooding

Scott

unread,
Oct 15, 2012, 12:57:00 AM10/15/12
to appfog...@googlegroups.com
Remove the single quotes from the getenv calls.  Instead of 

public $user = 'getenv(MYSQL_USERNAME)';

it should be

public $user = getenv(MYSQL_USERNAME);

for example.


--
You received this message because you are subscribed to the Google Groups "AppFog Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/appfog-users/-/O9tZ3rJDixUJ.

To post to this group, send email to appfog...@googlegroups.com.
To unsubscribe from this group, send email to appfog-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/appfog-users?hl=en.

Adam Wooding

unread,
Oct 15, 2012, 2:25:08 AM10/15/12
to appfog...@googlegroups.com
Hi Scott,

Thank you very much for your reply. Unfortunately, it didn't work and I am still getting the 500 Internal Error.

Thanks again,
Adam

Scott

unread,
Oct 15, 2012, 10:34:30 AM10/15/12
to appfog...@googlegroups.com
Are you using brackets ( '{' ) or parentheses ( '(' )?

It should be parentheses since getenv is a method call.  See http://php.net/manual/en/function.getenv.php for more information.

Thanks!
Scott


To view this discussion on the web visit https://groups.google.com/d/msg/appfog-users/-/R6N4R31jhs8J.

Adam Wooding

unread,
Oct 16, 2012, 12:08:04 AM10/16/12
to appfog...@googlegroups.com
Hi Scott,

Thanks again for your time and suggestions. 

Yes, I am definitely using parentheses but still no luck.

Maybe it's some limitation in Joomla?

Thanks again,
Adam

adam

unread,
Oct 16, 2012, 9:11:53 AM10/16/12
to appfog...@googlegroups.com
Hey Adam,

Taking a look on your account based on this e-mail address I don't see an app that's having trouble connecting to the DB. If you are still encountering trouble please send us a note to sup...@appfog.com with the app details and we'd be glad to take a look with you!

Thank you,

Adam
AppFog Support

Adam Wooding

unread,
Oct 16, 2012, 10:14:41 PM10/16/12
to appfog...@googlegroups.com
Hi Adam,

Thanks for your reply. 

I have actually hard-coded the database details into the configuration file so that I could get started working on the project. However I was just curious as to how to implement the getenv() function in the Joomla configuration file as is the suggestion in the phpFog documentation.

I will send through an email to the sup...@appfog.com email address.

Cheers,
Adam Wooding

Andrés Barbosa

unread,
Jan 31, 2013, 3:44:37 PM1/31/13
to appfog...@googlegroups.com
This worked for me:


<?php
class JConfig {
public $offline = '0';
public $offline_message = 'Este sitio está cerrado por tareas de mantenimiento.<br /> Por favor, inténtelo nuevamente más tarde.';
public $display_offline_message = '1';
public $offline_image = '';
       ....  .........
       public $feed_email = 'author';
       public $cookie_domain = '';
       public $cookie_path = '';
    
function __construct() {
     
    $services = getenv("VCAP_SERVICES");
    $services_json = json_decode($services,true);
    $mysql_config = $services_json["mysql-5.1"][0]["credentials"];

    $this->host = $mysql_config["hostname"];
$this->user = $mysql_config["user"];
$this->password =$mysql_config["password"];
$this->db = $mysql_config["name"];
Reply all
Reply to author
Forward
0 new messages