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
Related
Currently my Ubuntu PHP CLI is using: /opt/lampp/bin/php and /opt/lampp/etc/php.ini.
I plan to remove LAMP and continue to use /etc/php/7.2/apache2/ .
Should I change(and how to change) PHP CLI to using: /usr/bin/php7.2 and /etc/php/7.2/cli/php.ini ?
ribe#ideapad:~$ php --ini
Xdebug requires Zend Engine API version 320151012.
The Zend Engine API version 320170718 which is installed, is newer.
Contact Derick Rethans at https://xdebug.org/docs/faq#api for a later version of Xdebug.
Configuration File (php.ini) Path: /opt/lampp/etc
Loaded Configuration File: /opt/lampp/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
ribe#ideapad:~$ which php
/usr/local/bin/php
(this is symlink to lamp php:
ribe#ideapad:/usr/local/bin$ readlink -e php
/opt/lampp/bin/php-7.2.6
)
I have a problem where drush isn't able to connect to my drupal site with mysql. I think it's due to a module loading issue. For example, as root, I check if pdo_mysql is loaded like this:
# php -m|grep mysql
mysql
mysqli
pdo_mysql
# php -m|wc -l
55
# which php
/usr/bin/php
# php -i|grep conf
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
Additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/ldap.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini
But when I run this command as my user, I don't see any mysql modules:
$ php -m|grep mysql
$ php -m|wc -l
48
$ which php
/usr/bin/php
$ php -i|grep conf
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
Why is this? And how do I get these modules to be loaded in php-cli as my user?
I'm using php 5.3.10 (old I know, but it's for compatibility with our production servers) on ubuntu 14.04.
I solved this by making /etc/php5 executable: chmod a+x /etc/php5.
I've found other question like this but none seems to solve my problem. In my case it occurs on any artisan command, even if I just type "php artisan" the output is [PDOException] could not find driver.
I'm running Laravel 5 on Ubuntu 14.04 LTS, with a LEMP stack (PHP 5.6 fpm, Mysql, Nginx). In the config/database.php the default driver is set to mysql.
I've checked the output of php --ini, it seems to load all configuration files:
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/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-gd.ini,
/etc/php5/cli/conf.d/20-json.ini,
/etc/php5/cli/conf.d/20-mcrypt.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,
/etc/php5/cli/conf.d/20-readline.ini
If i open /etc/php5/cli/conf.d/20-pdo_mysql.ini i see:
; configuration for php MySQL module
; priority=20
extension=pdo_mysql.so
And this the content of /etc/php5/cli/conf.d/10-pdo.ini is:
; configuration for php PDO module
; priority=10
extension=pdo.so
Inside /etc/php5/cli/conf.d i see pdo ini files symlinked like this:
10-pdo.ini -> ../../mods-available/pdo.ini
20-mysql.ini -> ../../mods-available/mysql.ini
20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.ini
The symlink match the base directory /etc/php5/mods-available that contains all the ini files:
pdo.ini
pdo_mysql.ini
That's all. If someone already experienced this, some help would be really appreciated. Thanks!
So, after many attempts i finally find out how to fix it: just needed to install php5-sybase package. After that Artisan works perfectly!
I guess on homestead it's already installed, unluckily I needed to configure a bare-bone ISO on a VMWare Workstation.
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
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