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

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)

Related

Symfony WARNING: No configuration file (php.ini) used by PHP

I downloaded PHP using brew on Mac
# Update homebrew
brew update
# Add the tap
brew tap shivammathur/php
# Install PHP 8.0
brew install shivammathur/php/php#8.0
But when I run
symfony check:req
I get
> PHP is using the following php.ini file:
WARNING: No configuration file (php.ini) used by PHP!
Why Symfony doesn't access php.ini file?
Even though php.ini file exists, I checked that by:
php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/8.0
Loaded Configuration File: /usr/local/etc/php/8.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/8.0/conf.d
Additional .ini files parsed: /usr/local/etc/php/8.0/conf.d/ext-opcache.ini
Please consider that I am an absolute beginner in PHP
Thank You
I had the same problem as you and i solved it by changing the name of this file.
When i installed php, i created a file php.ini. (a copy of php.ini-development that i renamed in php.ini). I modified a few lines and i installed "Composer".
But when i checked symfony requirements, i saw this problem as you.
When i opened it with VSC i noticed the file was called php.ini.ini.
I think it was "Composer" who changed the name when i installed it.
I renamed it to php.ini and I no longer had this problem.

Strange PHP .ini inclusion in CLI vs Built-in server

My current config:
- MacOS Mojave
- PHP 7.3.5 installed via Homebrew
- XDebug 2.7.2 installed via PECL
- get_loaded_extensions() in both CLI and built-in server is enabled
While trying to configure XDebug on Mac I came across a strange problem.
When calling
$ php --ini
I get
Configuration File (php.ini) Path: /usr/local/etc/php/7.3
Loaded Configuration File: /usr/local/etc/php/7.3/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.3/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.3/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.3/conf.d/ext-xdebug.ini
whereas calling
print php_ini_scanned_files();
in the script executed via built-in PHP server yields
/usr/local/etc/php/7.3/conf.d/ext-opcache.ini
Web server does not include my xdebug config, therefore there is no way to set xdebug.remote_enable=1 option properly.
What is even "better" is that editing /usr/local/etc/php/7.3/php.ini to cause parsing errors gives no warnings whatsoever.
I'm puzzled. Does anyone has any idea what's the reason behind this?

How to install PHP Opcache on MacOS High Sierra?

I'm using the standard Apache and PHP 7.1 (not Homebrew) that comes with Mac High Sierra. However, it appears that this version doesn't have Opcache enabled even though it should come as standard with PHP 7. It's even listed in phpinfo() under "Module Authors", but no section showing it's actually installed. Calling opcache_get_status gives a fatal error.
I've installed the extension via Homebrew, and linked the opcache.so file. It appears to be working on the CLI but not in Apache. For some reason the CLI and web are using different ini files:
/usr/local/etc/php/7.1/php.ini for CLI
/etc/php.ini for web
The CLI is parsing the addition files including /usr/local/etc/php/7.1/conf.d/ext-opcache.ini, and php -i shows Opcache. But phpinfo() in the browser does not - no additional ini files are parsed.
I currently have this in /etc/php.ini:
[opcache]
zend_extension="/usr/local/opt/php71-opcache/opcache.so"
opcache.enable=1
But still nothing. I followed the exact same process for xdebug and it worked fine. What am I missing?
I wonder if it would be easier to use the Homebrew version of PHP. But I don't appear to have the required .so file. Various tutorials say to put this in Apache's httpd.conf:
LoadModule php7_module /usr/local/opt/php71/libexec/apache2/libphp7.so
But the libexec directory does not exist. There is lib but neither this nor any other directory has any .so file.
For me it worked by these steps:
Search extension_dir in "phpinfo()" page, I got a path
/usr/lib/php/extensions/no-debug-non-zts-20160303
By execute ls -lh /usr/lib/php/extensions/no-debug-non-zts-20160303, I found "opcache.so" , I guess it's installed when upgraded to "High Sierra"
Create "/etc/php.ini" (by copy "/etc/php.ini.default"), and modify:
[opcache]
zend_extension = opcache.so
opcache.enable = 1
Restart apache, module "opcache" is enabled
EDIT / CONCLUSION
Since "opcache extension" is installed on Mac OS High Sierra by default, the solution of enabling opcahe on Mac OS High Sierra is:
Create "/etc/php.ini" if you don't have one, by simply copy the default configuration: sudo cp /etc/php.ini.default /etc/php.ini
Add zend_extension = opcache.so to /etc/php.ini and set "opcache" enable:
php.ini opcache section looks like:
[opcache]
zend_extension = opcache.so
opcache.enable = 1

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.

Laravel 5: Artisan throw PDOException could not find driver

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.

Categories