Error installing Composer on web host via SSH - php

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.

Related

MediaWiki Wikibase Installation Trouble

I am currently attempting to install the Wikibase extension to my new Mediawiki installation. Here is the php stack trace:
running media wiki
Notice: Undefined index: entityNamespaces in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 212
Warning: array_merge(): Expected parameter 2 to be an array, null given in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 212
Notice: Undefined index: entityNamespaces in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 212
Warning: array_merge(): Expected parameter 2 to be an array, null given in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 212
Notice: Undefined index: entityNamespaces in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 212
Warning: array_merge(): Expected parameter 2 to be an array, null given in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 212
Fatal error: Uncaught TypeError: Argument 2 passed to Wikibase\Lib\WikibaseSettings::applyEntityNamespacesToSettings() must be of the type array, null given, called in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 103 and defined in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php:218 Stack trace: #0 /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php(103): Wikibase\Lib\WikibaseSettings::applyEntityNamespacesToSettings(Object(Wikibase\Lib\SettingsArray), NULL) #1 /var/www/mediawiki/extensions/Wikibase/client/includes/WikibaseClient.php(689): Wikibase\Lib\WikibaseSettings::getClientSettings() #2 /var/www/mediawiki/extensions/Wikibase/client/includes/WikibaseClient.php(737): Wikibase\Client\WikibaseClient::newInstance() #3 /var/www/mediawiki/extensions/Wikibase/client/includes/Hooks/MagicWordHookHandler.php(39): Wikibase\Client\WikibaseClient::getDefaultInstance() #4 /var/www/mediawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php(172): in /var/www/mediawiki/extensions/Wikibase/lib/includes/WikibaseSettings.php on line 218
I tried to follow the Wikibase Installation guide to the letter to only install Wikibase Client, but I don't think I did. Sepcificially I think my LocalSettings.php is the issue. I installed the extension as instructed by the guide, so I'm confident that I'm using whatever the most recent version of Wikibase is (though I can't seem to find a version number anywere) and I am using MediaWiki 1.35 with PHP 7.3.23-4 on Ubuntu 18.04 hosted with nginx.
This is the bit I added to the end of my LocalSettings.php that breaks my installation, but without I can't use infoboxes, which is my real goal here.
# Wikibase
wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
$wgWBClientSettings['repoUrl'] = 'https://pool.my.wiki';
$wgWBClientSettings['repoScriptPath'] = '';
$wgWBClientSettings['repoArticlePath'] = '/wiki/$1';
$wgWBClientSettings['repositories']['']['repoDatabase'] = 'poolwiki';
$wgWBClientSettings['repositories']['']['changesDatabase'] = 'poolwiki';
$wgWBClientSettings['siteLinkGroups'] = [ 'mywikigroup' ];
wgWBClientSettings['siteGlobalID'] = 'en';
I'm sure I just bungled an obvious step somewhere, but I've been over it so many times and I have no idea where.
I try to document all new installations very thoroughly for situations just like this, you can find my current setup along with the steps I took during installation on my github repository: https://github.com/PickleProgramming/AlQinaWiki
You can find my full LocalSettings.php there, along with any other files I might have bungled.
First of all, you need to switch your WikiBase to the version 1.35. Currently, you have 1.36 (master):
cd .../extensions/WikiBase
git checkout REL1_35
git pull
git submodule update --init --recursive
You also may need to install dependencies with Composer as described here.
Secondly, make sure that your wiki doesn't think that it is also a WikiBase repository. Insert $wgEnableWikibaseRepo = false before wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
Thirdly, which wiki is going to serve as a WikiBase repository for you?

PHP file not running in CRON/CLI

I have to run a php file every 5 seconds , and have two issues
1. The file works perfectly when opened in a browser, but running the 'php myfile.php' command fails and produces the following error
PHP Warning: include_once(../tutadmin/config/config.php): failed to open stream: No such file or directory in /var/www/html/cron/teacher_status_cron.php on line 3
PHP Warning: include_once(): Failed opening '../tutadmin/config/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/cron/teacher_status_cron.php on line 3
PHP Notice: Use of undefined constant TBL_USER - assumed 'TBL_USER' in /var/www/html/cron/teacher_status_cron.php on line 5
PHP Notice: Use of undefined constant TEACHER_USER_GROUP_ID - assumed 'TEACHER_USER_GROUP_ID' in /var/www/html/cron/teacher_status_cron.php on line 9
PHP Notice: Undefined variable: current_user_id in /var/www/html/cron/teacher_status_cron.php on line 14
PHP Notice: Undefined variable: current_date_time in /var/www/html/cron/teacher_status_cron.php on line 15
PHP Notice: Undefined variable: dbc in /var/www/html/cron/teacher_status_cron.php on line 20
PHP Fatal error: Uncaught Error: Call to a member function Query() on null in /var/www/html/cron/teacher_status_cron.php:20
Stack trace:
#0 {main}
thrown in /var/www/html/cron/teacher_status_cron.php on line 20
Crontab will not run the program every 5 seconds, only every minute at best.
Edit: the file does not work outside of cron in the CLI either, only on a web browser.. Cron is not the issue.
Because you have not right permissions on file, your cron can not open file, change permissions.

sh: 1: laravel: not found while laravel command works

I'm having trouble installing Laravel Spark. When I run spark new website I get the error sh: 1: laravel: not found. I read on the internet that this problem is usually caused by incorrect configuration of $PATH but this is not the case for me. I have composer global require laravel/installer and ~/.config/composer/vendor/bin has been added to my $PATH. When I type laravel in the terminal it simply works and I can make new Laravel websites.
I've also cloned the laravel/spark-installer repo and added it to my path and typing spark in the terminal also works.
The output I'm getting when I'm trying to create a new spark website is the following:
git#staging:~$ spark new sparktest
sh: 1: laravel: not found
Downloading Spark...
PHP Warning: file_put_contents(/home/git/sparktest/spark-archive.zip): failed to open stream: No such file or directory in /home/git/spark/src/Installation/DownloadSpark.php on line 59
PHP Warning: ZipArchive::extractTo(): Invalid or uninitialized Zip object in /home/git/spark/src/Installation/DownloadSpark.php on line 105
PHP Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /home/git/spark/src/Installation/DownloadSpark.php on line 107
PHP Notice: Undefined offset: 0 in /home/git/spark/src/Installation/DownloadSpark.php on line 120
PHP Warning: file_get_contents(/home/git/sparktest/composer.json): failed to open stream: No such file or directory in /home/git/spark/src/Installation/UpdateComposerFile.php on line 54
Loading composer repositories with package information
Updating dependencies (including require-dev)
Any ideas on what's wrong?
Thanks!
The PATH for Laravel should be: ~/.composer/vendor/laravel/installer" instead of ~/.config/composer/vendor/bin ...
Add a line to ~./bash_profile like:
export PATH="$PATH:~/.composer/vendor/laravel/installer"
Close and start a new shell, and enter:
$ laravel --version
Laravel Installer 2.0.1

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!

Can't connect to standalone mongodb: No candidate servers found

I have debian dev server with stock mongodb; php 5.4 and pecl mongodb drivers v1.4.3.
I tried to create simple conntection using PHP Cli and got exception:
php -r "MongoLog::setLevel(MongoLog::ALL); MongoLog::setModule(MongoLog::ALL); new MongoClient('mongodb://127.0.0.1:27017', array());"
the output below:
PHP Notice: PARSE INFO: Parsing mongodb://127.0.0.1:27017 in Command line code on line 1
PHP Notice: PARSE INFO: - Found node: 127.0.0.1:27017 in Command line code on line 1
PHP Notice: PARSE INFO: - Connection type: STANDALONE in Command line code on line 1
PHP Notice: CON INFO: mongo_get_read_write_connection: finding a STANDALONE connection in Command line code on line 1
PHP Notice: CON INFO: connection_create: creating new connection for 127.0.0.1:27017 in Command line code on line 1
PHP Notice: CON INFO: stream_connect: Not establishing SSL for 127.0.0.1:27017 in Command line code on line 1
PHP Notice: CON INFO: get_server_flags: start in Command line code on line 1
PHP Notice: CON FINE: send_packet: read from header: 36 in Command line code on line 1
PHP Notice: CON FINE: send_packet: data_size: 73 in Command line code on line 1
PHP Notice: CON FINE: get_server_flags: can't find maxBsonObjectSize, defaulting to 4194304 in Command line code on line 1
PHP Notice: CON FINE: get_server_flags: can't find maxMessageSizeBytes, defaulting to 8388608 in Command line code on line 1
PHP Notice: CON INFO: get_server_flags: found server type: UNKNOWN? in Command line code on line 1
PHP Notice: CON INFO: is_ping: pinging 127.0.0.1:27017;-;.;29554 in Command line code on line 1
PHP Notice: CON FINE: send_packet: read from header: 36 in Command line code on line 1
PHP Notice: CON FINE: send_packet: data_size: 69 in Command line code on line 1
PHP Notice: CON INFO: is_ping: last pinged at 1376577544; time: 0ms in Command line code on line 1
PHP Notice: REPLSET FINE: finding candidate servers in Command line code on line 1
PHP Notice: REPLSET FINE: - all servers in Command line code on line 1
PHP Notice: REPLSET FINE: filter_connections: adding connections: in Command line code on line 1
PHP Notice: REPLSET FINE: filter_connections: done in Command line code on line 1
PHP Notice: REPLSET FINE: limiting by seeded/discovered servers in Command line code on line 1
PHP Notice: REPLSET FINE: limiting by seeded/discovered servers: done in Command line code on line 1
PHP Notice: REPLSET FINE: limiting by credentials in Command line code on line 1
PHP Notice: REPLSET FINE: limiting by credentials: done in Command line code on line 1
PHP Fatal error: Uncaught exception 'MongoConnectionException' with message 'No candidate servers found' in Command line code:1
Stack trace:
#0 Command line code(1): MongoClient->__construct('mongodb://127.0...', Array)
#1 {main}
thrown in Command line code on line 1
I have found workaround - is downgrade dirver version to 1.3.6; but it is not a solution.
Take a look at: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
I solved my problem after installing 10-gen version mongodb.
Had the same problem today, downgraded to the 1.3.6 version of mongo driver in pecl "worked" for me... System: Debian Squeeze
This does the job for you:
pecl uninstall mongo
pecl install mongo-1.3.6

Categories