Ubuntu CLI, new path for PHP and php.ini - php

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
)

Related

Cannot enable OPcache on MacOS Sierra with PHP 7

I am finding it tricky to enable OPcache on my MacOS Sierra (10.12.6) system.
php --ini shows the ini file used:
Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File: /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.0/conf.d/ext-pdo_pgsql.ini
My php.ini looks like this:
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
However, when I look at phpinfo() it shows the following:
I've restarted Apache after making the change to my php.ini to include opcache, but it doesn't appear to be recognised.
I installed PHP with Homebrew, not MAMP although I do have MAMP install but unused.
I got to the bottom of this eventually...
In the output from phpinfo(), have a look at the .ini files listed under:
Additional .ini files parsed
There may be something like
/usr/local/php5/php.d/20-extension-opcache.ini
Make sure opcache.enable=1 is set in this file.

PHP does not updates

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

Phalcon module loaded but still class can't be found

I have installed Phalcon on my vServer and it seems to be loaded,
but if I try to run website I get an error
PHP Fatal error: Class 'Phalcon\\Config\\Adapter\\Ini' not found in /home...
php -v
PHP 5.6.10 (cli) (built: Jun 11 2015 08:33:51)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
I followed the instructions on Phalcon website.
If I list php modules using php -m Phalcon is listed, I don't have
any errors, just don't know why it's not working!
Also, Phalcon is not listed on phpinfo(); page.
looks like you changed the config for the php console client but that config is not the same for the php module in apache.
Review what config is being loaded for apache module
When installing phalcon in order to get the extension working make sure to restart nginx / apache2, and if you are running PHP as a module php5-fpm service as well.
$ sudo service nginx restart
$ sudo service php5-fpm restart
I encountered the same problem and the reason is that I recompiled php with source code but not recompiled phalcon again after that. I solved that by compiling phalcon again with the correct phpize.
Sometimes when phalcon is installed, it creates a separate .ini file for itself and adds the extension therein. This is common in mac and linux OS. In such situation, type php --ini on the terminal. You should see an out put similar to the following...
Configuration File (php.ini) Path: /usr/local/etc/php/5.6
Loaded Configuration File: /usr/local/etc/php/5.6/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.6/conf.d
Additional .ini files parsed: /usr/local/etc/php/5.6/conf.d/ext-mongodb.ini,
/usr/local/etc/php/5.6/conf.d/ext-phalcon.ini
As you can see, phalcon created the /usr/local/etc/php/5.6/conf.d/ext-phalcon.ini file.
SOLUTION:
Open the file using sudo nano /usr/local/etc/php/5.6/conf.d/ext-phalcon.ini, copy the line in which the extension is loaded and paste in /usr/local/etc/php/5.6/php.ini if you are using XAMPP, copy the line to /Applications/XAMPP/xamppfiles/etc/php.ini Restart your server and check if that works.

How to edit PHP configuration command in MAMP to exclude intl package

I am using MAMP Pro 3.0.5 to run Apache/PHP on my computer, running OS X (Yosemite DP2). I just installed an old project on my server, but I get an conflict with the intl package that is now being initialized (I guess this was not on my previous setup).
The phpinfo() provides me with the fact, that intl is laoded through the configuration command, which ends:
'--with-mcrypt=shared,/Applications/MAMP/Library' '--with-openssl' '--enable-zip' '--with-iconv=/Applications/MAMP/Library' '--enable-opcache' '--enable-cgi'
'--enable-intl'
'--with-icu-dir=/Applications/MAMP/Library' '--with-tidy=shared'
I cannot figure out where to edit this, so I can remove --enable-intl?
Update 1
There is not reference to intl in php.ini:
Update 2
$ /Applications/MAMP/bin/php/php5.5.10/bin/php --ini
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.5.10/conf
Loaded Configuration File: /Applications/MAMP/bin/php/php5.5.10/conf/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

PHP CLI don't call good php.ini

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

Categories