ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Chartdirector Extensions in Cloud Foundry
Posted by Richard on Jun-24-2022 21:26
Hi Peter,
I have a working version of chart directory using PHP on a virtual machine.
But when I try to port it to Cloud Foundry via a Buildpack, I get the below error.
I've tried lots of different things with no success. Any thoughts?
Thanks!
Richard

================================================
"Error Loading ChartDirector for PHP Extension

It appears this PHP system has not loaded the ChartDirector extension by using an extension statement in the PHP configuration file (typically called "php.ini"). An attempt has been made to dynamically load ChartDirector on the fly, but it was not successful. Please refer to the Installation section of the ChartDirector for PHP documentation on how to resolve this problem.

Error Log

The version and type of PHP in this system does not support dynmaic loading of PHP extensions. All PHP extensions must be loaded by using extension statements in the PHP configuration file.

System Information
Operating System : Linux 2b745992-c079-47e3-7746-f1d0 5.4.0-120-generic #136~18.04.1-Ubuntu SMP Fri Jun 10 18:00:44 UTC 2022 x86_64
PHP version : 7.4.27
PHP / Web Server interface : fpm-fcgi
PHP configuration file location : "/home/vcap/app/php/etc/php.ini"
PHP extension directory : "/home/vcap/app/php/lib/php/extensions/no-debug-non-zts-20190902"
====================================

Here is my php info dump:
======================================
PHP Version 7.4.27
System Linux 2b745992-c079-47e3-7746-f1d0 5.4.0-120-generic #136~18.04.1-Ubuntu SMP Fri Jun 10 18:00:44 UTC 2022 x86_64
Build Date Apr 6 2022 20:12:45
Configure Command './configure' '--disable-static' '--enable-shared' '--enable-ftp=shared' '--enable-sockets=shared' '--enable-soap=shared' '--enable-fileinfo=shared' '--enable-bcmath' '--enable-calendar' '--enable-intl' '--with-kerberos' '--with-bz2=shared' '--with-curl=shared' '--enable-dba=shared' '--with-password-argon2=/usr/lib/x86_64-linux-gnu' '--with-cdb' '--with-gdbm' '--with-mysqli=shared' '--enable-pdo=shared' '--with-pdo-sqlite=shared,/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-pgsql=shared' '--with-pgsql=shared' '--with-pspell=shared' '--with-gettext=shared' '--with-gmp=shared' '--with-imap=shared' '--with-imap-ssl=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-zlib=shared' '--with-libzip=/usr/local/lib' '--with-xsl=shared' '--with-snmp=shared' '--enable-mbstring=shared' '--enable-mbregex' '--enable-exif=shared' '--with-openssl=shared' '--enable-fpm' '--enable-pcntl=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--enable-shmop=shared' '--prefix=/tmp/build/391e1b0b/binary-builder/ports/x86_64-linux-gnu/php/7.4.27'
Server API FPM/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /tmp/build/391e1b0b/binary-builder/ports/x86_64-linux-gnu/php/7.4.27/lib
Loaded Configuration File /home/vcap/app/php/etc/php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20190902
PHP Extension 20190902
Zend Extension 320190902
Zend Extension Build API320190902,NTS
PHP Extension Build API20190902,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support disabled
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams compress.bzip2, php, file, glob, data, http, ftp, compress.zlib, phar
Registered Stream Socket Transports tcp, udp, unix, udg
Registered Stream Filters convert.iconv.*, bzip2.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*

=========================

  Re: Chartdirector Extensions in Cloud Foundry
Posted by Peter Kwan on Jun-28-2022 03:59
Hi Richard,

The error message means that ChartDirector for PHP is not installed for the PHP in the Linux. If you can telnet or ssh into your host, please check the followings in your host:

(a) Everything in "ChartDirector/lib" should be copied to the PHP extension directory. According to the error message, your PHP extension directory is:

/home/vcap/app/php/lib/php/extensions/no-debug-non-zts-20190902

Please go to that directory, and check if the files in ChartDirector/lib are copied to that directory. (Try "ls -l phpchartdir*.dll" and "ls -l libchartdir.*".) If there files are there, please check if they are readable and executable by the web server. (For testing, you may change their access rights to allow everybody read/execute access, the same as all standard utilities in the Linux host.)

(b) All PHP extensions, including ChartDirector, should be loaded using extension statements in the php configuration file. According to the error message, your PHP configuration file is at:

/home/vcap/app/php/etc/php.ini

Please check if there is a line "extension=phpchartdir740.dll" in the file. (Try "cat php.ini | grep phpchartdir")


Please make sure your system is configured to have ChartDirector installed as in (a) and (b) above.



In most web servers, there are error logs. The PHP may also have error log configured. Please check your error logs to see if there is any error message related to loading "phpchartdir???.dll".


Best Regards
Peter Kwan

  Re: Chartdirector Extensions in Cloud Foundry
Posted by Richard on Jul-03-2022 21:35
Hi Peter,
I finally got it to recognize the location of all the necessary ChartDirector files within the buildpack of the Cloud Foundry system. The solution is simple, but figuring it out was non-trivial.  I'll describe it here for any future users of Chart Director who want to port Chart Director into a Cloud Foundry application.

1) Create a new folder at my Cloud Foundry root called ".bp-config". Copy all the files under ChartDirector/lib into .bp-config.
2) Create the following folders and directory path ".bp-config/php/php.ini.d".  Copy the php.ini file included in the original Cloud Foundry file located at /home/vcap/app/php/etc/php.ini into the folder php.ini.d. (I used ssh to get a copy of the original php.ini OR you could get it from Cloud Foundry github.)
3) In the copy of php.ini, add the line "extension=/home/vcap/app/.bp-config/phpchartdir740.dll". This new version of php.ini may overwrite the default one provided by Cloud Foundry, so it's important to keep its original content but only add to it. Otherwise Cloud Foundry itself will not work.

So, in summary Cloud Foundry is very picky about how it is setup. But I was able to get all the demo php scripts for Chart Director to work correctly.
I'm sure there is probably an easier/better way to do this, but this one definitely works.

Thanks!
Richard