composer on the cpanel v68.0.29 - composer-php

Server running WHM/cPanel v68. As composer is now included globally with cpanel, I'am login SSH as a cpanel user and try to use composer, but nothing happens:
host#host [~]# composer --help
host#host [~]# composer diagnose
host#host [~]#
on another server with the same version of the Cpanel and CloudLinux, it's all right. What could be the reason? The version of php set to 7.1 with PHP Selector. Directive
allow_url_fopen On
are chosen in CPanel (as reccomended in documentation).
Unfortunately for the first time I try to use a Composer, I do not understand what it needs.
Update:
composer -V
Fatal error: Class 'Phar' not found in /opt/cpanel/composer/bin/composer on line 23

The error that you're seeing at the bottom -
Fatal error: Class 'Phar' not found in /opt/cpanel/composer/bin/composer on line 23
.. this means that the phar PHP extension is not loaded. If your cPanel is hosted on a CloudLinux environment you can see if you can enable it from
cPanel -> Select PHP Version -> Enable Extension
if not - you need to contact your hosting provider to see if they can enable it for you.

Related

Composer update or install issue

I have an web application which successfully run since august 2020. now i want to add milon barcode package and it successfully ok in local server that's why i need to run coposer install or update command in cpanel terminal. but there show some problem.
N.B Laravel version 5.8, composer version 2.0.6, php version 7.4.
when i try to run composer install it show error
PHP Fatal error: Uncaught ErrorException: proc_open(): unable to create pipe Too many open files in phar:///opt/cpanel/composer/bin/composer/vendor/symfony/console/Application.php:952
when try to run composer update
Failed to download phpoption/phpoption from dist: getaddrinfo() thread failed to start
when try to run composer self-update
[Composer\Downloader\FilesystemException]
Filesystem exception:
Composer update failed: "/opt/cpanel/composer/bin/composer" could not be written.
rename(/opt/cpanel/composer/bin/composer): failed to open stream: Permission denied
You need to enable proc_open
Please Follow the Instruction Below in cPanel
Software > MultiPHP INI Editor > Editor Mode
Select your PHP version and search for (disable_functions)
disable_functions = "proc_open,..., ..."
Now remove (proc_open) from the list and save.
Otherwise, contact your hosting service provider to enable proc_open.
try using this command
composer update --no-scripts

Setup Laravel project on cPanel

I'm trying to set up a laravel project as a subdomain on cpanel but I'm getting parsing issues, and an error.
These are the steps I've done so far
zip the project and upload it to this directory public_html/encuestas
unzip and move contents to the directory above
get ssh access with PuTTY and cd into the directory
do this command in PuTTY composer install --ignore-platform-reqs
I've also done it all through the PuTTY, cloned the repository from bitbucket with the same results.
After the command I get this feedback
vc#un.net [~/public_html/encuestas]# composer install --ignore-platform-reqs
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Parse error: syntax error, unexpected '?' in /home/vc/public_html/encuestas/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
And when I go to the subdomain encuestas.un.ac.cr this is the error I get
Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)
I'm not sure if this is relevant but I suspect the php versions are the problem, in cpanel I have set the php version of this domain to PHP 7.1 (ea-php71) and these errors still persist, however the PHP System Default is set as 5.6 (I don't know how to change it). This was the solution I found online for the parsing errors but this hasn't worked.
I'm completely lost as to what could be happening or how to fix it?
EDIT:
when doing composer update this is the result
vc#un.net [~/public_html/encuestas]# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.1.3 but your PHP version (5.6.40) does not satisfy that requirement.
Problem 2
- barryvdh/laravel-dompdf v0.8.5 requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
- barryvdh/laravel-dompdf 0.8.x-dev requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
- barryvdh/laravel-dompdf v0.8.5 requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
- Installation request for barryvdh/laravel-dompdf ^0.8.5 -> satisfiable by barryvdh/laravel-dompdf[0.8.x-dev, v0.8.5].
On that cPanel subdomain make sure to set the php version to at least 7.1.3 that can be done in cpanel itself in MultiPHP Manager
After that you will get a list of your subdomains, select it and from the top right choose a php version that works with that package at least(7.1.3) in your case, Click Apply.
If you don't have that php version installed on your server then contact the Admin to activate or install it.
If that didn't work, for the subdomain, try to set that PHP version to the root domain.
If you have access to WHM you can install a new PHP version through the easyApache panel.
Sometimes you have to restart Apache server in order for the new php to work.

Laravel - Error while running php artisan - with MAMP PRO

First steps with Laravel 5 on MacOSX running MAMP PRO stack.
php artisan
I got the following error:
[RuntimeException]
Error Output: PHP Warning:
require(/Users/../../bootstrap/../vendor/autoload.php): failed to open
stream: No such file or directory in
/Users/../../bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required
'/Users/../../bootstrap/../vendor/autoload.php' (include_p
ath='.:/Applications/MAMP/bin/php/php5.6.10/lib/php') in
/Users/../../bootstrap/autoload.php on line 17
It seems to be related with some bootstrap autoload and MAMP php binaries... But this is as far as I can understand this.
Can I have some advices please?
If I run composer update instead, I do get the same Fatal Error.
It seems you have give a wrong path,re install the laravel.
Thank you for your answers.
I had some issues with composer assets plugin. I have:
1) Remove the folder related to the composer assets plugin.
2) Reinstalled.
3) go to the root diretory of my laravel project.
4) run sudo composer install
Runned php artisan and all seems to be working as expected.
Thank you so much for your time.

Install Laravel framework on WAMP

I have been trying to install Laravel framework on WAMP.
I been following the steps from http://laravel.com/
and Installing Laravel 4.1 in Windows 7 // Make .phar file globally available to windows command line
When i run the command
composer create-project laravel/laravel --prefer-dist , getting the error message
[RuntimeException]
You must enable the openssl extension to download files via https
But i have enabled openssl in php.ini by removing the comment sign.
Please help
If you are using WAMPServer here is the problem:
WAMPServer's PHP CLI ( Command Line Interface ) i.e. running php.exe from command line uses a different php.ini to the one used by PHP in Apache.
Edit \wamp\bin\php\php5.x.y\php.ini
Activate the extensions you require the PHP CLI to have access to in the usual way i.e. remove the comment ';' from the extension=php_xxxx.dll line.
Wamp uses 2 php.ini
first one that you changed from the Wamp panel and second one that located on Apache folder.
i think on the wamp/bin/apache/bin make sure to enable openssl on both and restart the Wamp.
This worked for me. Hope this helps you.
Install Laravel Framework in Windows *PHP version greater than
5.3.7 is required.
Download Laravel from: https://github.com/laravel/laravel/archive/master.zip.
Extract Laravel into the www folder for WAMP.
Download Composer from: https://getcomposer.org/Composer-Setup.exe
Enable openssl from all php.ini files
Install Composer into the same directory php.exe is located.
Click on WAMP icon->PHP->PHP Extensions and enable: php_openssl, php_curl, php_socket.
Click on wamp icon->Apache->Apache Modules and enable ssl_module
Open cmd.
Change into the directory where you extracted Laravel e.g: cd C:\wamp\www\laravel.
Type the command: composer install.
Installation completed.
Open httpd.conf file
Add these lines after Include "c:/wamp/alias/"*
Listen 8000
DocumentRoot c:/wamp/www/laravel/public
Open Browser and go to localhost:8000
You follow given Only 1 step and install laravel 5 and composer in your machine
[1]Paste this in cmd : composer create-project laravel/laravel
when you run above command it will automatically install composer and laravel
OPTIONAL:
if error your configuration does not allow connection to
http//packages.firegento.com in cmd follow this command :
composer config -g secure-http false

Error in the start.php file after hosting the laravel 4 as sub-domain in the shared hosting

Fatal error: require(): Failed opening required '/home/portalt/laravel/bootstrap/laravel/vendor/laravel/framework/src' (include_path='/home/portalt/laravel/vendor/phpseclib/phpseclib/phpseclib:.:/usr/lib/php:/usr/local/lib/php') in /home/portalt/laravel/bootstrap/start.php on line 59
I got this error after hosting laravel 4 as sub-domain in the shared hosting. How to solve this?
This looks like an error with your vendors, have you run composer install?
Laravel on shared hosts can be problematic if you don't have ssh access, if you have ssh access make sure composer is installed:
composer --version
if it is then in your root directory run:
composer install
if it is not installed, download it from:
https://getcomposer.org/download/ and run install.
If you don't have ssh access have you been developing your application locally? you should be able to upload all your vendors via FTP.
How did you deploy your app and are the vendors in place?

Resources