I try to install a project via composer on my ubuntu.
When I run composer install I have the error :
[RuntimeException]
You must enable the openssl extension to download files via https
My apache is installed under /etc/apache2 and php in /etc/php5
I have installed openssl and when I check install with phpinfo(), I see openssl is correctly enabled.
I know composer invoke php command line.
So if I do this command :
php --ini
output
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
But there's no php.ini in /usr/local/lib
I don't know why php in command line take this configuration ?
thx
I removed my php binary under /usr/local/bin and php --ini command now return php5 configuration :
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-curl.ini,
/etc/php5/cli/conf.d/20-gd.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini
Related
I have installed PHP through Homebrew and I'm using Laravel Valet to serve my projects locally. I would like to update the memory_limit in PHP.ini but for some reason it looks like it's not updating.
If I run php --ini I get:
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/php-memory-limits.ini
I've updated memory_limit in both /usr/local/etc/php/7.4/php.ini and /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini.
Then I run:
brew services restart php#7.4
and
valet restart
If I then display phpinfo() in my project it still says memory_limit = 128M.
Here is how I solved this problem on mac:
I run: php --ini
It output:
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/error_log.ini,
/usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/php-memory-limits.ini
I edited /usr/local/etc/php/7.4/php.ini
Restart php.
Still same issue.
Then I edited /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini,
restart.
It worked.
So I'm currently running php 5.5.34 on my mac.
I tried installing php 5.6 via :-
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6
However, after installing when I ran php -v , it again gave me 5.5
What am I doing wrong here?
Edit.
php --ini output
Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File: /usr/local/php5/lib/php.ini
Scan for additional .ini files in: /usr/local/php5/php.d
Additional .ini files parsed: /usr/local/php5/php.d/10-extension_dir.ini,
/usr/local/php5/php.d/20-extension-opcache.ini,
/usr/local/php5/php.d/40-curl.ini,
/usr/local/php5/php.d/40-openssl.ini,
/usr/local/php5/php.d/50-extension-apcu.ini,
/usr/local/php5/php.d/50-extension-curl.ini,
/usr/local/php5/php.d/50-extension-gmp.ini,
/usr/local/php5/php.d/50-extension-igbinary.ini,
/usr/local/php5/php.d/50-extension-imap.ini,
/usr/local/php5/php.d/50-extension-intl.ini,
/usr/local/php5/php.d/50-extension-mcrypt.ini,
/usr/local/php5/php.d/50-extension-memcached.ini,
/usr/local/php5/php.d/50-extension-mongodb.ini,
/usr/local/php5/php.d/50-extension-mssql.ini,
/usr/local/php5/php.d/50-extension-pdo_pgsql.ini,
/usr/local/php5/php.d/50-extension-pgsql.ini,
/usr/local/php5/php.d/50-extension-propro.ini,
/usr/local/php5/php.d/50-extension-raphf.ini,
/usr/local/php5/php.d/50-extension-readline.ini,
/usr/local/php5/php.d/50-extension-redis.ini,
/usr/local/php5/php.d/50-extension-solr.ini,
/usr/local/php5/php.d/50-extension-ssh2.ini,
/usr/local/php5/php.d/50-extension-xdebug.ini,
/usr/local/php5/php.d/50-extension-xsl.ini,
/usr/local/php5/php.d/60-extension-pecl_http.ini,
/usr/local/php5/php.d/99-liip-developer.ini
OS: Debian 8.6 amd64, PHP 7.0.13 source(tar.gz) download from php.net, checked the md5 and sha256.
Try --with-config-file-scan-dir set to /etc/php7/cli/conf.d or /etc/php7/cli/conf.d/ still not working.
root#debian:/usr/src/php-7.0.13#./configure \
--prefix=/usr/local/php7 \
--with-config-file-path=/etc/php7/cli \
--with-config-file-scan-dir=/etc/php7/cli/conf.d/ \
--disable-all \
--enable-json=shared
root#debian:/usr/src/php-7.0.13# /usr/local/php7/bin/php --ini
Configuration File (php.ini) Path: /etc/php7/cli
Loaded Configuration File: /etc/php7/cli/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
In /usr/src/php-7.0.13/main/build-defs.h file last but one line, the PHP_CONFIG_FILE_SCAN_DIR constant was defined, but still not working.
#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php7/cli/conf.d/"
If export the PHP_INI_SCAN_DIR environment variable, it's working.
root#debian:/usr/src/php-7.0.13# export PHP_INI_SCAN_DIR=/etc/php7/cli/conf.d/
root#debian:/usr/src/php-7.0.13# /usr/local/php7/bin/php --ini
Configuration File (php.ini) Path: /etc/php7/cli
Loaded Configuration File: /etc/php7/cli/php.ini
Scan for additional .ini files in: /etc/php7/cli/conf.d/
Additional .ini files parsed: /etc/php7/cli/conf.d/json.ini
Update
When 1st building, I forget setting --with-config-file-path and --with-config-file-scan-dir, so I used export PHP_INI_SCAN_DIR=/etc/php7/cli/conf.d/ and it's working.
So I remove it and building again, But I used export PHP_INI_SCAN_DIR= NOT unset. So in the 2nd building, the PHP_INI_SCAN_DIR env variable is still working and it's empty.
The correct way
unset PHP_INI_SCAN_DIR
You need to make sure that PHP_INI_SCAN_DIR is non-null in the environment, if it's going to be used:
krakjoe#fiji:/usr/src/php-src$ export PHP_INI_SCAN_DIR=
krakjoe#fiji:/usr/src/php-src$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php-cli.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
krakjoe#fiji:/usr/src/php-src$ export PHP_INI_SCAN_DIR=/etc/php.d
krakjoe#fiji:/usr/src/php-src$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php-cli.ini
Scan for additional .ini files in: /etc/php.d
Notice that the first execution exhibits the same symptoms you see.
I'm using Ubuntu LTS 14.04 operating system and I'm trying to test my PHP scripts in the PHP CLI, but wherever my code attempts to connect to MySQL, with commands such as...
$mysqli = mysqli_connect($host,$user,$password,$database);
...,I get the following error:
Fatal error: Call to undefined function mysqli_connect()...
I've reviewed /etc/php5/cli/php.ini AND /etc/php5/apache2/php.ini and have found no difference.
I think that I must enable mysqli support for the command line interface (CLI), but I am uncertain.
How can I correct the error without affecting my current Apache php.ini/configuration/installation?
EDIT:
Based on comments, I ran the following command in terminal:
php --ini
Which displays:
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Then, I copied /etc/php5/cli/php.ini to /usr/local/lib/php.ini.
Then, I ran php --ini again, which displays:
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: /usr/local/lib/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Then, I ran the PHP script from PHP CLI again, and the same error displayed.
Call to undefined function mysqli_connect()
Means the mysqli exension is not loaded.
I've reviewed /etc/php5/cli/php.ini AND /etc/php5/apache2/php.ini and have found no difference.
I would be very surprised if they were same. But in both cases, these are likely to be structured to work with extesnions distributed via packages - i.e. the ini file containing the directive to load the mysqli so extension will likely reside elsewhere and be included (or not) from these files.
Configuration File (php.ini) Path: /usr/local/lib
You have a Frankenstein system. You need to clean this up. Either use the distro's packaged apps or install apps from tarball. Don't use tarballs unless you know what you're doing. Don't mix and match unless you really know what you are doing.
Delete the tarball PHP files
reinstall the Ubuntu PHP cli
reinstall the Ubuntu PHP mysqli extension
test.php:
if (!extension_loaded('mysqli')) {
dl('mysqli.so');
}
in cli,run it:
php test.php
os output:
Warning: dl(): Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli: cannot open shared object file: No such file or directory in test.php
you can find and copy mysqli.so from any where, for example:
/usr/local/lib/php/extensions/no-debug-non-zts-20131226$ sudo cp /usr/lib/php5/20131226/mysqli.so ./mysqli.so
After installing php as ISAPI on IIS7 phpinfo function shows that no php.ini were loaded:
Loaded Configuration File (none)
By command line PHP is loading php.ini file successfully
C:\PHP>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\PHP\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
How can I solve it?
The only php.ini file on the server is on C:\PHP. There is no php.ini on C:\Windows.
The php.ini file were created by php installer and is untouched so far.
tks