composer-php fail to install laravel - php

I'm trying to move a laravel project to a remote server.
I just copy the folder on the public/html folder, then I've tried to install composer as described here:
https://getcomposer.org/download/
with the very first command I've seen this error:
/federlegno$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
PHP Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in Command line code on line 1
PHP Warning: copy(): Failed to enable crypto in Command line code on line 1
PHP Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1
as solution I find to run the command without the https: php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
and then it seems thats the others command works, without promt any error (I've tried even to visit the link with the browser and it works!).
Then when I try to run:
composer install
inside the laravel folder this error is raised:
bash: composer: command not found
Some additional information:
/federlegno$ php -r "phpinfo();" | grep OpenSSL SSL Version =>
OpenSSL/1.0.2r OpenSSL support => enabled OpenSSL Library Version =>
OpenSSL 1.1.0j 20 Nov 2018 OpenSSL Header Version => OpenSSL 1.1.1a
20 Nov 2018 Native OpenSSL support => enabled
php version:
ederlegno$ php -v PHP
7.2.15-1+0~20190209065123.16+stretch~1.gbp3ad8c0 (cli) (built: Feb 9 2019 06:51:24) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.15-1+0~20190209065123.16+stretch~1.gbp3ad8c0, Copyright (c) 1999-2018, by Zend Technologies
Laravel version 5.4

You should move the composer.phar file (which is downloaded by the installation scripts) to the /usr/local/bin or /usr/bin directory
sudo mv composer.phar /usr/local/bin/composer
or
sudo mv composer.phar /usr/bin/composer

Related

"PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/http.so'" after downgraded PHP from 8.1 to 7.1

We have a requirement that needs to downgrade PHP from 8.1 to 7.1 in our Ubuntu 18 server.
sudo update-alternatives --set php /usr/bin/php7.1
After the downgrade, we're seeing PHP Startup error everytime we check php -v
Below is the exact error text:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/propro.so' - /usr/lib/php/20160303/propro.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/raphf.so' - /usr/lib/php/20160303/raphf.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/http.so' - /usr/lib/php/20160303/http.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 7.1.33-47+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jun 27 2022 08:15:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33-47+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
The missing libraries are really not found in the said directory as I checked.
/usr/lib/php/20160303
We have tried reinstalling as suggested from other forum with same error.
sudo apt-get install --reinstall `dpkg -l | grep 'ii php7.1' | awk '{ printf($2" "); next}'`
It works for them but not in ours.
I hope I can get help here. Thanks in advance.
By the way, I'm not a Linux and PHP developer. Just starting getting into it.
--reinstall will only reinstall the things that are installed, but it looks like you actually removed a number of modules. The propro, raphf, and http modules are not standard and are not installed by default. If you don't actually need/use them, you can just disable them so that they don't try to load:
phpdismod propro raphf http
However, if your app requires these modules, you'll need to explicitly add them:
apt install php7.1-propro php7.1-raphf php7.1-http

How can I fix an unable to load dynamic library gd2 php warning error?

I have an error in php 7.3 that I have been trying to solve for a while. Unable to load dynamic library 'gd2'.
I thought I had found the solution here:
https://blog.amirasyraf.com/blog/php-startup-unable-to-load-dynamic-library-gd-so
I tried removing sudo apt purge php7.3-gd and reinstalling it sudo apt update && sudo apt install php7.3-gd but this did nothing to help. I have no libgd.so files listed under /usr/local/lib. I used locate libgd and found /usr/lib/x86_64-linux-gnu/libgd.so.3. I created a symlink from /usr/local/lib/libgd.so to /usr/lib/x86_64-linux-gnu/libgd.so.3 and this did nothing to help.
uname -a
Linux 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux
php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'gd2' (tried: /usr/lib/php/20180731/gd2 (/usr/lib/php/20180731/gd2: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/gd2.so (/usr/lib/php/20180731/gd2.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.19-1~deb10u1 (cli) (built: Jul 5 2020 06:46:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.19, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.19-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.0RC2, Copyright (c) 2002-2019, by Derick Rethans
Can anyone help me solve this problem? What am I overlooking in trying to find a solution?
I encountered the same issue and went searching for the cause:
grep -r gd2.so /etc/php/7.4 and grep -r gd2.so /etc 2>/dev/null
this came up empty ...
... but omitting the .so found the culprit:
grep -r gd2 /etc/php 2>/dev/null
/etc/php/7.4/cli/php.ini:extension=gd2
I edited the file /etc/php/7.4/cli/php.ini and commented it out with ; so it read ;extension=gd2
Now I do not get the error anymore
Note that this solution disables gd2. This will solve the issue only if you can live without the gd2 library

How to enable PHP Intl extension on macOS Mojave?

I'm trying to install Magento (2.3.0) on macOS Mojave. Magento shows PHP Extension intl. is missing.
I tried the below to resolve:
Made a copy of php.ini using cp /etc/php.ini.default php.ini
Removed ";" before extension=php_intl.dll
Restart Apache sudo apachectl restart
But the above did not resolve.
On checking php -v, i'm seeing the below error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20160303/php_intl.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/php_intl.dll,
0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-
non-zts-20160303/php_intl.dll in Unknown on line 0
PHP 7.1.19 (cli) (built: Aug 17 2018 20:10:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
There are only 2 files under /usr/lib/php/extensions/no-debug-non-zts-20160303 namely opache.so and xdebug.so
How can i install or enable "PHP Extension intl" on my macOS Mojave?
Here's a solution that worked for me:
Find all PHP versions installed brew list | grep php
Remove all versions of PHP brew remove --ignore-dependencies --force php70 php71 php72 (based on what you see above)
Install PHP brew install php72 (i chose 7.2, 7.3 is not supported yet by several vendors)
Run the command which php should show you the path to the installed PHP. Copy the path.
Update your bash_profile vi ~/.bash_profile and add this line to the file:
export PATH=/usr/local/php5/bin:$PATH
Save and run this source ~/.bash_profile
Check if PHP Intl Extension is installed using php -m | grep intl. If the installation went well, we will see intl listed. If not the extension is not installed.
I think from PHP 7 (not sure of the version), the extensions are available by default and we need not enable them in php.ini file explicitly.
If you installed Homebrew's php, linking it to a directory in your path will fix the issue.
brew link --force php#7.3
I had the same issue and that fixed it.
Here is a link where I got a detailed answer from
Got help from the link and able to compile https://donatstudios.com/Install-PHP-Mcrypt-Extension-in-OS-X
Next we will download the PHP source. Verify the exact version of PHP you are running. This can be retrieved as follows. The version is highlighted.
$ php --version
PHP 7.1.19 (cli) (built: Aug 17 2018 18:03:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Now we move into a working directory and download the source making sure to update the following for the version from above.
$ cd /tmp
$ curl -L http://php.net/get/php-{{php-version}}.tar.bz2/from/this/mirror > php.tar.bz2
$ open php.tar.bz2
Now we will compile and test the extension.
$ cd php-{{php-version}}/ext/{{extension}}
$ phpize
$ ./configure
$ make
$ make test
$ sudo make install
If all that goes well finally we'll need to add the following to our php.ini - I usually add at it at the end of the file.
extension = {{extension}}
.so
You can verify your installation with the following:
$ php --info | grep {{extension}}\\.
Lastly, depending on your setup now you may want to restart apache.
$ sudo apachectl restart

Running Composer with MAMP: Unable to load dynamic library mcrypt.so

I am attempting to get composer running on my Mac and using MAMP. I installed composer using
sudo curl -sS https://getcomposer.org/installer | phpmamp
So, in .bash_profile, I've added the following alias
alias phpmamp='/Applications/MAMP/bin/php/php5.5.14/bin/php'
After installing, I also moved composer.phar to /usr/local/bin/composer
Now I try to run composer and I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so' - dlopen(/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so, 9): Library not loaded: /usr/local/lib/libmcrypt.4.4.8.dylib
Referenced from: /usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so
Reason: image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so' - dlopen(/usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so, 9): Library not loaded: /usr/local/lib/libmcrypt.4.4.8.dylib
Referenced from: /usr/local/Cellar/php53-mcrypt/5.3.26/mcrypt.so
Reason: image not found in Unknown on line 0
??+?%
Here's my php version info:
PHP 5.5.14 (cli) (built: Jul 25 2014 17:02:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
I've tried adding the following to my bash_profile with no luck/difference:
PATH=/Applications/MAMP/bin/php/php5.5.17/bin:$PATH
You're trying to load PHP 5.3 libraries into a PHP 5.5 installation. You need to install a PHP 5.5 version of mcrypt. If you're using Homebrew to manage your PHP install (which you should), brew install php55-mcrypt will do the trick.

Drush + Cygwin PHP fatal errors

I have had to re-install / update Cygwin on Windows 8.1, and I have some how broken Drush on my Drupal 7 sites.
Previously I followed this guide Here So I have tried to do a clean install of drush, and noticed that you can now install drush via pear.
pear channel-discover pear.drush.org
pear install drush/drush
So in my home directory :
$ drush --version
Drush Version : 6.2.0
That seems to work, but when I go into my directory where my Drupal web site is, I am getting PHP fatal errors, it is like the PATH or something is broken when I run drush from there :
$ cd /cygdrive/c/websites/www.mywebsite.com
$ drush
require_once(c:/websites/www.mywebsite.com/modules/system/system.module): failed to open stream: No such file or directory drupal.inc:21 [warning]
PHP Fatal error: require_once(): Failed opening required 'c:/websites/www.mywebsite.com/modules/system/system.module' (include_path='.:/usr/share/pear') in /usr/share/pear/drush/includes/drupal.inc on line 21
require_once(c:/websites/www.mywebsite.com/modules/system/system.module): failed to open stream: No such file or directory drupal.inc:21 [warning]
PHP Fatal error: require_once(): Failed opening required 'c:/websites/www.mywebsite.com/modules/system/system.module' (include_path='.:/usr/share/pear') in /usr/share/pear/drush/includes/drupal.inc on line 21
My Current set up is :
Windows 8.1
Cygwin
Drupal 7
For PHP I am using WAMP, but PHP is working in Cygwin
.
$ php -v
PHP 5.5.16 (cli) (built: Aug 24 2014 01:12:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
When using Cygwin's version of PHP, the "require" statement does not recognize path names which start with a drive letter. Thus require 'C:\path-to-file' will generally fail. Internally, it sees the 'C:' as a relative path and appends it to the default directory rather than treating it as an absolute path.
If you rewrite the require statements to use __DIR__, then things usually work.
require __DIR__ . '/modules/system/system.module';

Categories