pvwatts version 5 calculator demo. sscphp.so

9 posts / 0 new
Last post
emiliocernadas@...
pvwatts version 5 calculator demo. sscphp.so

Hi,
I am trying to run pvwatts version 5 calculator demo, the php that comes in the sam open source folder. When I press the button "calculate" I get this error message: Fatal error: Call to undefined function sscphp_data_create() in /www/docs/FILE_PATH/pvwatts.php on line 267

Any idea how to fix it?

Probably is because I didn`t create the "sscphp.so"

Could it be possible to have the steps needed to create the dynamic library "sscphp.so" for a mac 10.10, please

thank you very much!
Best regards

Paul Gilman

Dear Emilio,

On a Mac, you should be able to use the code generator to create a set of files to access the SSC API via PHP.

Please see the How-to video "Generate SDK code from SAM" for a quick video demonstrating how the code generator works:

https://sam.nrel.gov/webinars

Best regards,
Paul.

emiliocernadas@...

Dear Paul,

Thanks for your reply. I followed your advice, and I generate the code with the tool "generate code" from sam-osx-2017-1-17-r4 version but I still couldn`t succeed. When I run the make file I got the following error message:

gcc -shared -O2 -fPIC -I/usr/include/php -I/usr/include/php/TSRM -I/usr/include/php/main -I/usr/include/php/ext -I/usr/include/php/Zend -o sscphp.so sscphp.c ./ssc.so
clang: error: no such file or directory: './ssc.so'
make: *** [sscphp.so] Error 1

I will appreciate any advise on how to fix it.

Thank yo very much

Best regards,
Emilio

emiliocernadas@...

Dear Paul,

just in case I clarify that I am trying to run PVWatts V5 calculator web application using php file "SSC PHP extension"
Written by A.Dobos

thank you very much

best regards

sjanzou

The PHP wrapper in SAM is compliant with

PHP7 tested on Fedora 25 with PHP 7.0.25 and Zend 3.0.0.
PHP5 tested on CentOS 7 with PHP 5.4.16, Zend 2.4.0.

Zend extensions for PHP have changed all their calling conventions in versions other than 2.4.0 and 3.0.0.

You can find both the PHP and Zend version used by the following command in a terminal window:

php -version

Using MacOS 10.12, I see that the default PHP version is 5.6.0 with Zend 2.6.0 which is not supported by the wrapper.

Which versions of PHP and Zend are on your macOS 10.10 system?

Be sure to update the PHPDIR to point to the folder on your system with the PHP header files...

For reference, the steps to build the sscphp.so on Ubuntu 16.04 are:

1. sudo apt-get update
2. sudo apt-get install ubuntu-desktop
3. Download SAM
4. Create a PVWatts/No financial case
5. Generate PHP 7 code
6. PHP 7.2.3 and Zend 3.2.0
7. php development tool missing when test make in code generated folder
8. sudo add-apt-repository ppa:ondrej/php
9. sudo apt-get install php7.2-dev (Updates to php 7.2.4 with same Zend)
10. in code generated from SAM file, vi Makefile
11. PHPDIR=/usr/include/php/20170718 and save
12. make
13. make run

emiliocernadas@...

Thank you very much sjanzou! I will follow those steps

Best regards!

emiliocernadas@...

sjanzou,

I have installed a MAMP with two version of php (php 5.4.5 and 7.2.1) so I can switch between them. Lately I was using php 7.2.1 with Zend 2.4.0 also I´m using mac 10.10.5 (OS X Yosemite).

emiliocernadas@...

Sorry I made a mistake!, I have Zend 3.2.0

emiliocernadas@...

Thank you very much sjanzou, for the moment I was able to overcome the first obstacle and finally I already have the file sscphph.dylib. The solution was to include some libraries within the gcc command of the makefile.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer