Composer not working on windows, gives [Composer\Exception\NoSslException] error - php

I'm trying to install laravel on windows 10. I installed composer to install laravel but it gives me below error.
[Composer\Exception\NoSslException] The openssl extension is
required for SSL/TLS protection but is not availab le. If you can
not enable the openssl extension, you can disable this error , at
your own risk, by setting the 'disable-tls' option to true.
Command doesn't matteri it gives above error with all commands...
I checked out this question and used solutions but it didin't work for me..
I tried these solutions
composer config -g -- disable-tls true
extension=php_openssl.dll // open openssl extension in php.ini file. - I restarted apache after that but nothing changed

I had the same issue. I did the following things to make sure the composer works out.
Find the php.ini which corresponds to where you issue the command from.
php --ini
sample output before correction:
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
This C:\WINDOWS here is a hoax. When I looked in the php installation directory, I found out there is NO php.ini. There are two files php.ini-development and php.ini-production. Just rename one to php.ini
Then you should see the correct ini path when you do php --ini
Set the extensions directory
Afterwards, open the php.ini file and uncomment the following line
;extension_dir = "ext"
should be
extension_dir = "ext"
Enable extensions
Then uncomment the extensions the same way. The following are usually required. (But please find out what you need from the messages you see from composer commands)
extension=fileinfo
extension=gd2
extension=mbstring
extension=openssl

I was running php7.2.x on my Windows 10 machine before I upgraded to PHP 7.4.10 (cli)
When I first pulled up the php.ini file, to my surprise, it was empty.
To be sure that I was looking at the right file, I did
php --ini
I was looking at the correct file.
I looked at the php folder of XAMPP and noticed two files:
php.ini-production.ini
php.ini-development.ini
I copied the contents of the first file and pasted in my php.ini file.
Then after a restart, I saw a ton of other modules were not being loaded.
I then went in to my php.ini file's Dynamic Extensions sections and had to uncomment all the following extensions:
extension=bz2
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
extension=oci8_12c ; Use with Oracle Database 12c Instant Client
extension=odbc
extension=openssl
extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop
And then restarted Apache server agan, after saving my php.ini file.
This time, everything worked!

Related

PHP extensions not found via httpd but are found from CLI, with the same php.ini

I wanted to use some extensions of PHP 7.1 after installing it and Apache 2.4 and on my Windows 7. I wrote a small test script index.php to call some functions of the given extensions.
<?php
var_dump(mb_strlen('p'));
var_dump(mysqli_connect_error());
and uncommented the appropriate lines from the php.ini, like
...
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
...
and configured the extension_dir according to the windows-specific part of the php.ini
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"
extension_dir = "ext"
I restarted the Apache web server and fetched the http://localhost/index.php. I got the error messages:
Fatal error: Uncaught Error: Call to undefined function mb_strlen() in C:\Program Files\Apache24\htdocs...
which means the extension was not loaded.
I doublechecked that the php.ini I made the modifications in is the same as the phpinfo() displayed in the browser:
Loaded Configuration File C:\Program Files\php\php.ini
On the contrary, if I started the same index.php not via web server but from the command line then I got different output:
C:\Program Files\Apache24\htdocs>"C:\Program Files\php\php.exe" index.php
int(1)
NULL
which means the extensions were loaded properly.
The command line PHP uses the same php.ini:
c:\Program Files\Apache24\htdocs>php -i|find "Loaded Configuration File"
Loaded Configuration File => C:\Program Files\php\php.ini
How can it be that the same php.ini file loads the extensions from command line but does not load them when used via the web server?
Contrary to the description in the php.ini, the extension_dir should be specified with a full path, not just a relative one. Changing the line in php.ini from
extension_dir = "ext"
to
extension_dir = "C:/Progra~1/php/ext"
and restarting the web server solved the problem.
NB: I used the DOS-8.3 path instead of "C:/Program Files/php/ext" because according to the php-7.1.11-Win32-VC14-x64.zip\install.txt manual, it does not like paths containing spaces:
You may choose a different location but do not have spaces in the path (like C:\Program Files\PHP) as some web servers will crash if you do.
The path I referred to doesn't contain any spaces so I don't think I did anything wrong. Despite this, I am not sure how it would work if I had installed php to the default directory c:\php but it seems that defining the full path is a more secure way.
Check which modules is Apache using:
go to your apache config. IE: cd /etc/apache2/mods-enabled
list enables modulesls -lsai php* (in my case, prev version was enabled)
remove previous modules (IMC: rm php*)
enable needed module. IMC:
sudo ln -s ../mods-available/php7.4.load
sudo ln -s ../mods-available/php7.4.conf
reload apache (IMC: sudo /etc/init.d/apache2 restart)
use print/dump phpinfo(); to check which php module Apache is runnig
Command in example will work on Linux/Unix machines. Not on windows I'm afraid

Call to undefined function Illuminate\Encryption\openssl_decrypt()

I am using xampp and windows along with laravel, everything was working fine, but when I finished work and turned of xampp and try to open my work today morning, this is what I get:
FatalThrowableError in Encrypter.php line 100:
Fatal error: Call to undefined function Illuminate\Encryption\openssl_decrypt()
Encrypter.php is a standard laravel file and I have not even touched it. My extension is turned on.
extension=php_openssl.dll
What might be wrong?
Just edit php.ini file and uncomment by removing ";" before this line --extension=openssl. in php.ini file. and it will start working properly.
If you have shut XAMPP down and restarted it, it may be worth running the composer install command again, or simply running composer update to ensure that all dependancies are being loaded correctly.
Modify php.ini and enable openssl extension in you php environment.
To find php installation path, run below command in terminal or cmd
php --ini
Output something like below:
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\php-7.3.8\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
here mine is
Loaded Configuration File is C:\php-7.3.8\php.ini
open php.ini with any editor using vim, nano, notepad++ or any editor.
find extension=openssl remove ;
from ;extension=openssl
to extension=openssl
save and restart server.
composer install
didn't fix the problem, but the following does:
composer update
This problem can also arise if incorrect php.ini file is loaded.
Make sure in your config php_module is defined in the httpd.conf
<IfModule php_module>
PHPINIDir "C:/xampp/php"
</IfModule>

PHP unable to load dynamic library "php_pdo_oci.dll"

I'm running Apache 2.4.7 with PHP 5.5.9 on Windows 8. I installed PHPUnit and this warning image "warning" started to pop up.
Yes I enabled extension loading in php.ini as well as "extension_dir" to correct folder and there is file named "php_pdo_oci.dll" in that folder.
I tried to use different apache and php releases, but it didn't help.
Any suggestions how to fix this?
The ..._oci.dll is part of the Oracle C Interface. Unless you need to use Oracle, I suggest you go to the relevant line inside the php.ini file and uncomment the loading of this extension. However, if you need to use this extension, you’ll need to install the free Oracle Client libraries and add them to the path.
Oracle has a page where you can download the libraries needed for your setup work as expected and you can see here:
Oracle Instant Client Downloads
Note: After you choose your operational system (Windows as in your answer) in download section you will see the installation guide in foot notes of the next page. For others OSs this process will work the same way.
I currently have PHP version 7.1.9 and encountered this problem and resolved the issue. Just ensure these lines in your php.ini file are uncommented like so:
extension=php_fileinfo.dll
extension=php_ftp.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
extension=php_openssl.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_shmop.dll
Please restart your server application (IIS, Apache e.t.c.) after any changes to your php.ini file.
Please add below line in php.ini file
extension=pdo.so
extension=php_pdo.dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
and restart apache server and check.

PHP - PHP Warning: PHP Startup: in Unknown on line 0

I installed apache2 and php 5.4.5.
When you start apache this error:
PHP Warning: PHP Startup: in Unknown on line 0
The extension does not work:
; extension = php_intl.dll
; extension = php_ldap.dll
; extension = php_oci8.dll
; extension = php_oci8_11g.dll
; extension = php_pdo_firebird.dll
; extension = php_pdo_oci.dll
; extension = php_pdo_pgsql.dll
; extension = php_pgsql.dll
; extension = php_pspell.dll
; extension = php_shmop.dll
And maybe more.
Extensin dir: extension_dir = "C :/ dev/prog/php5/ext /"
Path: C: \ dev \ prog \ php5
php.ini is copied to C: \ WINDOWS \
ssleay32.dll php5ts.dll and is copied to C: \ WINDOWS \ system32 \
Please simple instructions.
upgrade those modules using pecl command
Also, Check extension_dir directive in php.ini
I had the same problem. The issue is, that these lines are by default in php.ini
; On windows:
; extension_dir = "ext"
I assumed, that only an uncomment of the second line and Apache restart solves this problem. But it isn't!
I had to type a full path to the ext folder, such as below:
extension_dir = "d:\php-5.4.32\ext"
After this action, and restart of the Apache web server, the problem was solved.
You should check you php.ini file to make sure the extension_dir is exactly set.
I had the same problem when i enable these five extensions:
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_curl.dll
The number of warnings is the same as the extensions that enabled.
So i guess may be there is sth. wrong with the extension setting.
When i change the extension_dir directive to the right dir, the problem resolved.
I found this answer in this post on the wampserver forums, and it worked for me:
Click on the Apache version that you use in the WAMPServer menu, e.g.
wampmanager -> Apache -> Version -> 2.4.9 ( just click on the version number on this menu item )
this will rebuild the SYMLINKS for the extensions that are causing the "in Unknown on line 0" error.
The answer was given by RiggsFolly in this thread: http://forum.wampserver.com/read.php?2,128734
I had the same problem when I enabled extensions (see Error when enabling PHP extensions).
I resolved it adding the PHP folder to the path and restarting the computer.
You need to download and install Aspell for Windows “GNU Aspell-0.50.3 (win32)”.
http://aspell.net/win32/
http://ftp.gnu.org/gnu/aspell/w32/Aspel ... -Setup.exe
Your Dictionaries are also here. Aspell needs at least one Dictionary to operate.
or
ftp://ftp.gnu.org/gnu/aspell/w32/
ftp://ftp.gnu.org/gnu/aspell/w32/Aspell ... -Setup.exe
ftp://ftp.gnu.org/gnu/aspell/w32/aspell-w32-0.50.3.zip
Aspell should copy the “aspell-15.dll” to the “Windows/System32” directory which the php entension php_pspell.dll requires and looks for to execute.
If not then locate aspell-15.dll in C:/Program Files/Aspell/bin/aspell-15.dll and copy it to C:/Windows/System 32/aspell-15.dll
You only need now to uncomment this line in:
xampp/apache/bin/php.ini
;extension=php_pspell.dll
to this:
extension=php_pspell.dll
Restart Apache.
(If Apache won't start paste the error message here).
Check the pspell module is in place and enabled by lookin at your phpinfo() file from the menu within the XAMPP Welcome Page. http://localhost/index.php
For more info visit https://community.apachefriends.org/f/viewtopic.php?p=83942
The problem is not coming from there, the problem is from the path (I mean %PATH% for Windows users, because of %PATH% is a variable that contains many paths separated by ;). So to figure out the problem you have to:
1-make configuration in the httpd.conf file:
PHPIniDir "${path}/conf_files"
2-make configuration in your php.ini file (it must be in the same location with the httpd.conf file):
change this:
extension_dir = "${path}\php\ext\"
To
extension_dir = "D:\EasyPHP5.3.0\php\ext\"
(in my case the php is installed in D:\EasyPHP5.3.0)
Optional:
if you need to execute PHP from the CLI (Command Prompt)
you have to make copy of the php.ini file to the folder when the PHP is installed (in my case D:\EasyPHP5.3.0\php)
Restart/Start your web Server and enjoy!
I had similar problem. cURL required SSL layer. Problem was in installation of php_curl library, see http://php.net/manual/en/curl.installation.php. The firs problem: libeay32.dll and ssleay32.dll are required on PATH. I put them in apache/bin directory. The second problem is that php.ini required php_openssl loaded before php_curl so I modified ini file.
extension=php_openssl.dll
extension=php_curl.dll
I solved the problem on my windows 7 with two steps:
set extension_dir as absolute path in php.ini
extension_dir = "d:\php-5.4.32\ext"
comment the php_curl.dll module in php.ini
;extension=php_curl.dll
Same problem was solved by changing to full path:
PHPIniDir in httpd.conf and extension_dir in php.ini.

Missing DLL when run as script

I'm trying to get a PHP script to run every 30 minutes on my server (Win XP SP3, xampp 1.7.3).
To do so I'm running the following script (update.cmd) using the MS task scheduler
SET PATH="C:\xampp\PHP"
start php.exe \htdocs\update_dashboard.php
I am using the oci8 php extension on my webserver, but when I run that script it gives me errors that php.exe can't find the necessary dll for the oci8 extension. I get the following errors:
This application has failed to start because OCI.dll was not found. Re-installing the application may fix this problem.
PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll' - The specified module count not be found.
I know that the file is there and I don't get those errors when the php is run through apache, am I running the wrong copy of php.exe? Any ideas why not? Does my PATH have to be set differently? My Windows PATH includes:
C:\instantclient_11_2;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\ActiveState Komodo Edit 5\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Altiris\Software Virtualization Agent\
Thanks for your help.
I found this problem when I switch from php 5.3 non thread safe to php 5.3 thread safe on windows 7, and I ticked install everything
I fixed the issue by commenting out extension=php_oci8.dll, extension=php_oci8_11g.dll, extension=php_pdo_oci.dll in the php.ini
I also had issues with the sybase extension wanting a libcs.dll, which I solved by removing "extension=php_sybase_ct.dll"
eg
; at bottom of php.ini -->>
[PHP_BZ2]
extension=php_bz2.dll
[PHP_CURL]
extension=php_curl.dll
[PHP_ENCHANT]
extension=php_enchant.dll
[PHP_FILEINFO]
extension=php_fileinfo.dll
[PHP_GD2]
extension=php_gd2.dll
[PHP_GETTEXT]
extension=php_gettext.dll
[PHP_GMP]
extension=php_gmp.dll
[PHP_IMAP]
extension=php_imap.dll
[PHP_INTL]
extension=php_intl.dll
[PHP_LDAP]
extension=php_ldap.dll
[PHP_MBSTRING]
extension=php_mbstring.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
;[PHP_OCI8]
;extension=php_oci8.dll
;[PHP_OCI8_11G]
;extension=php_oci8_11g.dll
[PHP_OPENSSL]
extension=php_openssl.dll
[PHP_PDO_MYSQL]
extension=php_pdo_mysql.dll
;[PHP_PDO_OCI]
;extension=php_pdo_oci.dll
[PHP_PDO_ODBC]
extension=php_pdo_odbc.dll
[PHP_PDO_PGSQL]
extension=php_pdo_pgsql.dll
[PHP_PDO_SQLITE]
extension=php_pdo_sqlite.dll
[PHP_PGSQL]
extension=php_pgsql.dll
[PHP_SHMOP]
extension=php_shmop.dll
[PHP_SNMP]
extension=php_snmp.dll
[PHP_SOAP]
extension=php_soap.dll
[PHP_SOCKETS]
extension=php_sockets.dll
[PHP_SQLITE]
extension=php_sqlite.dll
[PHP_SQLITE3]
extension=php_sqlite3.dll
;[PHP_SYBASE_CT]
;extension=php_sybase_ct.dll
[PHP_TIDY]
extension=php_tidy.dll
[PHP_XMLRPC]
extension=php_xmlrpc.dll
[PHP_XSL]
extension=php_xsl.dll
[PHP_EXIF]
extension=php_exif.dll
Guessing if you need sybase and oracle database connections the standard clients install oci.dll and libcs.dll in the appropriate places, for everyone else who doesn't need to use these dbs just disable the php extensions, and it should run fine :)
Ant
I've solved the problem in a way by changing the script. It's now:
C:\xampp\PHP\php.exe -f C:\xampp\htdocs\php_scripts\utils\update_dashboard.php
Thanks for the help.
Check the php.ini file that php is using by running a phpinfo() from the command line, and look to see what extensions are enabled in that file. It's quite commopn for php to be set to use a different php.ini file when running from the command line; and xampp certainly uses a different php.ini file by default. You can also tell it what php.ini file to use with the -c switch
I ran the php -m command. Turned out that my system's OCI.dll went either corrupt or missing. I recovered it by running sfc /scannow in the run box, rebooted, system reinstalled it, and it was up and running with my extensions now all working.
Am I correct that both C:\instantclient_11_2 and C:\oracle\ora92\bin contain a OCI.DLL? Because of the order of the path you might load the wrong dll. When I read Which OCI8 DLL to use in PHP 5.3 you need a different line in the php.ini depending on the version of the oracle client. I currently have no access to a pc with oracle, so I cannot verify this.

Categories