[VPS] Creating Environment Variables

software development

#1

Hello,

I’m trying to create an environment variable like that:

export LD_LIBRARY_PATH=/home/riderflipflops/privado/simapi-php-5.0.1/lib/:$LD_LIBRARY_P ATH

It’s working because when I try to Echo, it works on shell:

echo $LD_LIBRARY_PATH
/home/riderflipflops/privado/simapi-php-5.0.1/lib/:

However, when I look at phpinfo() (on apache + php webserver), there is nothing about that variable, so I can`t access it from PHP.

PS: I already created an PHP.ini specifically for this host.

What am I doing wrong?


#2

Setting an environment variable in the shell doesn’t affect things outside that shell, such as PHP.

You will need to set the environment variable separately in PHP, using the putenv function.


#3

hmmm ok, I thought it could be acessible in PHP.

So, I’m trying to install a CyberSource Simple Order API for PHP, there is a short guide (of course I’ve already read it)

http://apps.cybersource.com/library/downloads/cybersource_developer_kits/PHP/Linux/readme

[ Readme - http://apps.cybersource.com/cgi-bin/pages/dev_kits.cgi?kit=PHP/Linux ]

I’ve been problem on step 5. When I trigger a function that uses these API, it can’t be loaded.

Do you have any idea?
[hr]
Another observation: I’m using CGI (not FastCGI, because I’m using CodeIgniter framework).


#4

Ah… blech. That’s quite a bit tougher, since you don’t have a lot of control over PHP’s environment while it’s still loading extensions. You may need to mess around with a custom PHP launcher (i.e, dispatch.fcgi or similar) to get this working.

I see a more serious problem, though: CyberSource doesn’t even have a version of their extension for PHP 5.3 or later. This is a really bad sign; PHP 5.3 was released over three years ago. I’d strongly recommend that you seek out an alternative, as PHP 5.2 is nearing end-of-life. (The PHP development group has already abandoned it.)