Running symfony3 on Openshift, composer not found - composer-php

I recently discover OpenShift and look exactly what I needed. Now I'm trying to running a simple symfony3 project on it. I create an application with this cartridge (since I need php 5.5), successfully installed after waiting some minutes ,and then upload a symfony project from my local laptop to the created www folder. Now I'm lost on how to activate composer to install and update vendors.
I read this link, and as it say I create an empty file called use_composer in the marker folder. Then I login with a putty client, go to my project folder(app-root/runtime/repo/www/symfony/), but executing composer install on it give me 'composer: command not found'. I'm sorry if it's a newbie question, but in fact I'm not a linux user. Maybe I need to restart the application or something.
Any help will be appreciated.

I find an answer from this article
Execute curl -s https://getcomposer.org/installer | php -- --quiet --install-dir=$OPENSHIFT_DATA_DIR
Now you can call composer like this php $OPENSHIFT_DATA_DIR/composer.phar update

Related

Call to undefined method Maatwebsite\Excel\Facades\Excel::create() - Laravel 5.3

I'm using Maatwebsite Laravel Excel to export .xls documents.
In my 'localhost' it works perfectly, but when I try to do it in production, show me this f*$%#* error:
FatalThrowableError in Facade.php line 237:
Call to undefined method Maatwebsite\Excel\Facades\Excel::create()
I follow all the instalation instructions in: Laravel Excel
I also can't run "composer update" in production with SSH because the process is "killed"... I don't know why.
Do I really have to run the composer update? Is this why?
I'm using PHP 7.0 and Laravel 5.3, so I use the Laravel Excel version 2.1, the 3 version is only for Laravel >5.5.
Please help me!
Thanks in advance for your help.
I think you have not added Maatwebsite\Excel\Facades\Excel facade string in the providers array in app.php on production site?
As you are not able to run composer update due to process killed, see here hint related to updating on a hint related to updating on the server.
Run composer update in a local environment (either your local
physical machine, or a development virtual machine)
Upload or git push the composer.lock file
Run composer install on the live server
SOLVED
I runned "php artisan config:clear" and the error has changed to:
[screenshot][1]
I've uploaded (again) my "config/app.php" and then it told me:
"Permission denied to write in "bootstrap/cache"
So I "sudo chmod -R 777 /bootstrap"
Thank you.

how to fix error laravel 5.2 "failed to open stream: No such file or directory" without composer

I've got this error in my laravel 5.2 project who hosted in debian linux
Warning: require_once(/home/u706561288/public_html/sap/vendor/composer/autoload_real.php): failed to open stream: No such file or directory in
/home/u706561288/public_html/sap/vendor/autoload.php on line 5
Fatal error: require_once(): Failed opening required '/home/u706561288/public_html/sap/vendor/composer/autoload_real.php' (include_path='.:/opt/alt/php70/usr/share/pear') in
/home/u706561288/public_html/sap/vendor/autoload.php on line 5
so many forum like stackoverflow tell me to using php artisan "composer update" but
unfortunately my hosting package not available to composer instalation
please tell me how to fix this problem
I suggest that you test these steps
On the Localhost, run these two commands (composer update and composer dump-autoload)
Re-upload the entire project on the server
Also, if the problem is not resolved, you can delete the ‍Vendor folder and the composer.lock file and run the composer install command and Re-upload the entire project again.
When the hosting service or some PC does not allow to install Composer and appears error like in my case, follow these steps:
Delete all laravel project in hosting service. I recommend to use smartftp for good speed file access and tracked action.
Back to our localhost project and run composer install --no-scripts command and then composer clearcache.
Reupload all laravel project.
Don't forget to configure .env file.
I hope this can help with the same problem in future.
I had the same error while back, what I did to solve it was. I delete all the vendor folder from the root project then install it back by executing composer install
delete the ‍Vendor folder and the composer.lock file and run the composer install command and Re-upload the entire project again
this helped me
If anyone still facing the issue after deleting the vendor directory and did composer install try to update your composer by composer selfupdate then do the same install process.

Can't execute composer.phar in shared hosting

I've installed Composer on a shared-host (hostgator) following this guide:
https://laravel.io/forum/02-13-2014-how-to-install-laravel-on-a-hostgator-shared-server
It was installed using this command:
curl -sS https://getcomposer.org/installer | php
When I try to run composer I get the message "/home2/georger/composer.phar: no such file or directory" although the file does exist, I can open it. Other questions that deal with this suggest moving it to /usr/local/bin but that's not an option for me.
As outlined in the installation instructions, you will need to pass it to the php interpreter:
$ php composer.phar
Alternatively, you might want to reconsider whether you really want to execute composer in a production environment or rather execute it during the deployment and then deploy the artifacts. In other words, you probably want to run composer install on the machine from which you want to deploy to the production system, and then synchronize files from there to the production system, for example, using rsync.
For reference, see https://getcomposer.org/doc/00-intro.md.

Installing Composer and Laravel

I have installed composer in windows platform. But when am trying to install the composer.phar through this command,
php -r "readfile('https://getcomposer.org/installer');" | php
it's giving me this error-
Warning: readfile(https://getcomposer.org/installer): failed to open
stream: A connection attempt failed because the connected par ty did
not properly respond after a period of time, or established connection
failed because connected host has failed to respond. in Command line
code on line 1.
The internet configuration is OK. Please help. Am going through a hell of time...installing Laravel .
Had also some problem with the installation.
At the end I used the installer:
https://getcomposer.org/Composer-Setup.exe
Installing with installer
That line just pulls and outputs a file that contains a PHP script that will actually install Composer, thats why it is piped to PHP in the end of the line.
If readfile doesn't work, you can simply download the file with your browser by saving the file from https://getcomposer.org/installer then execute it from the folder where you downloaded:
cat ~/installer | php
Assuming that you downloaded it to your home ~ folder with the name installer.
Manual installation
It also worth mentioning that this installer just makes a few checks after it copies the actual composer.phar file, that you can download by yourself from the bottom of the download page, with the link named: Latest Snapshot
Thats all. By downloading that file you technically "installed" Composer. Just go to the folder where you downloaded it and you can start to use it:
php composer.phar
I the solution above didn't work for me. So I found another way for time being to make things moving. So, I used Larapack. I know that's like running away from problems but it worth it for now. As I move on, I will find a way round.
Thanks a lot guys for your help.

Cant' get MongoDB PHP Extension to work

I've been following this tutorial to try to install the PHP MongoDB extension but unfortunately haven't been able to get it working.
http://www.marcwitteveen.com/tech/mac/installing-mongodb-on-a-mac-so-you-can-access-it-with-php/
I can access the collections in the terminal, the database is properly installed but I didn't manage to get the extension working.
I have the following problem:
Sinan-MBP:mongo-php-driver-master Sinan$ cd
Sinan-MBP:~ Sinan$ sudo pecl install mongo
pecl/mongo is already installed and is the same as the released version 1.4.1
install failed
I've been trying several times so that's probably why I get this message. However, even after adding "extension=mongo.so" to the php.ini, I can't use MongoDB in my PHP code.
Thank you for your help.
This is likely a case of modifying the wrong php.ini for the environment, or PHP not being able to find the mongo.so in its directory. If you have separate php.ini files for CLI and web environments, PECL might have installed the compiled extension to a different directory.
If you run through the installation docs, there are instructions for grepping extension_dir from php -i and ensuring that mongo.so is present in that directory. If your web environment has a separate php.ini file, then grepping output from php -i likely won't help. You may need to view phpinfo(); output through your web server and check for the extension directory there.
One additional test that PECL installation succeeded would be attempting to view reflection information for one of the driver classes from the CLI environment. You can do so with php --rc MongoClient, which should print info on the methods of the MongoClient class.
I don't know why it was not working but I found a workaround late last night.
I uninstalled the php extension and then installed it again and made sure the extension was loaded in the php.ini
sudo pecl uninstall mongo
sudo pecl install mongo

Resources