Architecture issue with PECL extension - php

I'm trying to get the Trader PECL extension running on my Mac Sierra/PHP 7.1 but to no avail.
I used:
sudo pecl install trader
and got (tail end of my results):
Build process completed successfully
Installing '/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so'
Warning: Invalid argument supplied for foreach() in Validator.php on line 870
Warning: Invalid argument supplied for foreach() in /usr/local/pear/share/pear/PEAR/PackageFile/v2/Validator.php on line 870
Warning: Invalid argument supplied for foreach() in v2.php on line 1664
Warning: Invalid argument supplied for foreach() in /usr/local/pear/share/pear/PEAR/PackageFile/v2.php on line 1664
Warning: Invalid argument supplied for foreach() in v2.php on line 1664
Warning: Invalid argument supplied for foreach() in /usr/local/pear/share/pear/PEAR/PackageFile/v2.php on line 1664
install ok: channel://pecl.php.net/trader-0.4.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=trader.so" to php.ini
I then added:
extension=/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303
/trader.so
and restarted Apache. After typing php -m, I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so' - dlopen(/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so, 9): no suitable image found. Did find:
/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so: mach-o, but wrong architecture
/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so: mach-o, but wrong architecture in Unknown on line 0
OK; so my error is tell me that I'm using the wrong architecture. How can I change the architecture so that the extension works?
UPDATE: As recommended, I tried to compile by source and now am getting the error:
/Users/me/downloads/trader-0.2.2/trader-0.2.2/functions/trader_acos.c:61:2: error: too many arguments provided to
function-like macro invocation
TRADER_DBL_ZARR_TO_ARR(zinReal, inReal)
^
./php_trader.h:243:37: note: expanded from macro 'TRADER_DBL_ZARR_TO_ARR'
zend_hash_get_current_data(ht, (void **)&data) == SUCCESS; \
^
/Applications/AMPPS/php-7.1/include/php/Zend/zend_hash.h:214:9: note: macro 'zend_hash_get_current_data' defined here
#define zend_hash_get_current_data(ht) \
^
/Users/me/downloads/trader-0.2.2/trader-0.2.2/functions/trader_acos.c:61:2: error: use of undeclared identifier
'zend_hash_get_current_data'; did you mean 'zend_hash_get_current_data_ex'?
TRADER_DBL_ZARR_TO_ARR(zinReal, inReal)
^
./php_trader.h:243:6: note: expanded from macro 'TRADER_DBL_ZARR_TO_ARR'
zend_hash_get_current_data(ht, (void **)&data) == SUCCESS; \
^
/Applications/AMPPS/php-7.1/include/php/Zend/zend_hash.h:198:30: note: 'zend_hash_get_current_data_ex' declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
^
/Users/me/downloads/trader-0.2.2/trader-0.2.2/functions/trader_acos.c:61:2: warning: implicit declaration of function
'Z_DVAL_PP' is invalid in C99 [-Wimplicit-function-declaration]
TRADER_DBL_ZARR_TO_ARR(zinReal, inReal)
^
./php_trader.h:246:14: note: expanded from macro 'TRADER_DBL_ZARR_TO_ARR'
arr[i] = Z_DVAL_PP(data); \
^
1 warning and 2 errors generated.
make: *** [functions/trader_acos.lo] Error 1

Related

unable to start php debugger in vscode after php upgrade to 8.0; cannot open browscap.ini

Following my update from php 7.3 to php 8.0, I am no longer able to debug in VS Code. I am using the PHP pack extension.
I attempted uninstalling/reinstalling extensions and restarting vscode.
I get the error:
PHP Warning: Cannot open "C:\XXX\browscap.ini" for reading in Unknown on line 0
PHP Fatal error: Unable to start standard module in Unknown on line 0
Warning: Cannot open "C:\xXXX\browscap.ini" for reading in Unknown on line 0
Fatal error: Unable to start standard module in Unknown on line 0

Error installing Composer on web host via SSH

I'm able to SSH into my web host(Bluehost) just fine. In my root folder(public_html) I installed composer with the following command..
curl -sS https://getcomposer.org/installer | php
When I run "php composer.phar" I get an error that pops up in the command line.
[ErrorException]
Invalid argument supplied for foreach()
I notice in my root folder where I installed composer I keep getting a file called error.log that includes the following...
PHP Notice: Undefined variable: argv in - on line 13
PHP Notice: Undefined index: argv in phar:///home2/websitename/public_html/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 55
PHP Warning: array_shift() expects parameter 1 to be array, null given in phar:///home2/websitename/public_html/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 59
PHP Warning: Invalid argument supplied for foreach() in phar:///home2/websitename/public_html/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Not sure what to do next. My end goal is to install Laravel. Any assistance would be appreciated.

Composer update doesn't work in my case

I installed Laravel 5.0 at my websites (via FTP). Then I tried to connect via SSH and update using Composer. However I am getting this error. (My PHP is version 5.5, I checked the phpinfo function).
PHP Notice: Undefined index: argv in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 55
PHP Warning: array_shift() expects parameter 1 to be array, null given in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 59
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
[ErrorException]
Invalid argument supplied for foreach()
X-Powered-By: PHP/5.3.28
Content-type: text/html
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Notice: Undefined index: argv in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 55
Warning: array_shift() expects parameter 1 to be array, null given in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 59
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
I controlled cli -v , I getting this command not found.
Later I tried below:
$ php -d register_argc_argv=1 "./composer.phar" install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- league/flysystem 1.0.16 requires php >=5.4.0 -> your PHP version (5.3.28) or value of "config.platform.php" in composer.json does not satisfy that requirement.
- league/flysystem 1.0.16 requires php >=5.4.0 -> your PHP version (5.3.28) or value of "config.platform.php" in composer.json does not satisfy that requirement.
- Installation request for league/flysystem 1.0.16 -> satisfiable by league/flysystem[1.0.16].
I suspect this is the important error:
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Try which php to see where your PHP binary is pointing, and then locate bin/php to find out what other versions you have your system.
Also note this:
My PHP is version 5.5; I checked the phpinfo function
Something disagrees with you:
X-Powered-By: PHP/5.3.28
Try other copies of your PHP binary, discovered with locate, using the fully-qualified path. For example:
/usr/bin/php55-cli composer.php update
If this host has a 5.5 CGI binary and a 5.3 console binary, it is possible they do not know what they are doing - 5.3 should no longer be supported these days. If you do not have any luck fixing it yourself, create a support ticket and ask for php to invoke the 5.5 console binary from the shell.
Update: following from the conversation in the comments, it looks like the above has fixed one problem and exposed another. The new problem is that your Composer command is getting further, and it is trying to invoke a PHP helper that uses the php binary again. This then causes the original problem (it's the web server binary, and it's 5.3 rather than 5.5).
To resolve this, I suggest you (a) create a local php executable to point to the version you want, and then (b) reset the system path. I would try the following, in your project directory:
ln -s /usr/bin/php55-cli ./php
PATH=. ./php composer.phar update
What this will do is create a symbolic link to the version of PHP that you want, and then reset the system path temporarily to just the current directory.
If this does not fully resolve the issue, you may need to put your symlink in a more permanent place (e.g. ~/bin/php and modify your shell start-up file. Please be willing to play around with this before exclaiming that it does not work - the best way to learn how to do this independently is to try!

PHP Restler Server 500 Error

I've installed restler using composer. I've set up a virtual host for it. I'm able to go to my localhost in my browser and it shows some informational pages but as soon as I try one of the APIs I get a server 500 error.
My PHP logs say:
Function main
Error Type E_ERROR
Source File /public/examples/_001_helloworld/index.php : 18
Error String Class 'Luracast\Restler\Restler' not found
I'm using the example code straight out of the project. It looks like it has the require_once '../../../vendor/restler.php' and it seems to still have 500 errors.
I'm using PHP 5.4.16 on a Mac.
Update
Here are all of my logs:
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(/Users/ChrisLondon/composer/autoload_classmap.php): failed to open stream: No such file or directory in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(): Failed opening '/Users/ChrisLondon/composer/autoload_classmap.php' for inclusion (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/opt/local/lib/php') in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(/Users/ChrisLondon/composer/autoload_namespaces.php): failed to open stream: No such file or directory in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(): Failed opening '/Users/ChrisLondon/composer/autoload_namespaces.php' for inclusion (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/opt/local/lib/php') in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_values() expects parameter 1 to be array, boolean given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 154
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_merge(): Argument #2 is not an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 155
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_merge(): Argument #1 is not an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 155
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_map(): Argument #2 should be an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 166
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_filter() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 166
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: natsort() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 167
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_unique() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 170
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: implode(): Invalid arguments passed in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 170
[05-Sep-2013 17:05:09 America/Denver] PHP Fatal error: Class 'Luracast\Restler\Restler' not found in /Users/ChrisLondon/personal/SuperfyMe/public/examples/_001_helloworld/index.php on line 19
It seems like it's trying to find the autoload class here: /Users/ChrisLondon/composer/autoload_classmap.php but the file is actually here: /Users/ChrisLondon/personal/SuperfyMe/vendor/composer/autoload_classmap.php
Solved my issue.
It turns out because I have a folder named composer/ that happens to be two folders up from where the Restler app sits it ruins the Restler autoloader. To solve the issue one needs to do one of the following:
1) Don't have any folder named composer/ two folders up from where the Restler app resides
2) Modify the Restler autoloader to skip the folder (at the time of this post you could comment out line 138 of /vendor/Luracast/Restler/Autoloader.php)
A more elegant solution has been proposed by me on GitHub:
Issue: https://github.com/Luracast/Restler/issues/195
Pull Request: https://github.com/Luracast/Restler/pull/196
By the time someone else finds this post hopefully the issue will be resolved in future versions of Restler.

numfmt_format() expects parameter 1 to be NumberFormatter, null given

I recently upgraded my WAMP server and I can't seem to get the Intl extension to work. I've made sure that
the extension path in both ini files are correct
the extension is loaded in both inis
I can see the extension with php --re intl
I can see an example function with php --rf numfmt_create
I have icu dlls files in my php folder (icu 46, php 5.3.8, wamp 2.2)
I have appended C:\wamp\bin\php\php5.3.8 to the PATH in System variables
The code is correct - working code before wamp upgrade and php manual example codes fail
I'm trying to use the Number Formatter but it gives me some strange errors. Take this example code from the php manual for example:
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
$fmt = numfmt_create( 'it', NumberFormatter::SPELLOUT );
echo numfmt_format($fmt, 1142)."\n";
?>
It gives me this:
A PHP Error was encountered
Severity: Warning
Message: numfmt_format() expects parameter 1 to be NumberFormatter,
null given
Filename: controllers/test.php
Line Number: 867
Backtrace:
File: C:\wamp\www\application\controllers\test.php Line: 867
Function: numfmt_format
File: C:\wamp\www\index.php Line: 260 Function: require_once
A PHP Error was encountered
Severity: Warning
Message: numfmt_format() expects parameter 1 to be NumberFormatter,
null given
Filename: controllers/test.php
Line Number: 869
Backtrace:
File: C:\wamp\www\application\controllers\test.php Line: 869
Function: numfmt_format
File: C:\wamp\www\index.php Line: 260 Function: require_once
I notice that numfmt_create() seems to be returning NULL regardless of what I do.
can you run the icuinfo.exe tool from ICU to see if ICU is loading its data properly?
Apparently the 64 version of WAMP did not have correct icu dlls - using the 32 version worked.

Categories