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.
Related
Hello I'm using latest version of Laravel, PHP 7.1.9 and MySQL 5.7.19. I'm also using WAMP stack.
When I run the command:
php artisan migrate
I get the following error:
I googled a lot and I' m 100% sure my php.ini file does not have the driver line commented out and the driver is properly working, as seen here:
The driver is obviously present:
Also the path to extension dir is absolute:
extension_dir ="c:/wamp64/bin/php/php7.1.9/ext/"
What else can I do? This thing is driving me crazy
There are 2 php.ini files in the WAMPServer implementation.
One for APACHE which is the one accessed from the menu system and one in each wamp\bin\php\phpx.y.z folder
As you are using the PHP CLI you have to check that all the required extensions are also activated in PHP you are using for the CLI wamp\bin\php\phpx.y.z
Do this from the command line
php --ini
It should show you something like this
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\wamp64\bin\php\php7.0.29\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Look at this param Loaded Configuration File: to see which php.ini file you should be checking.
This post may also be useful to you for making a batch file to run from the command prompt to switch easily from one version of PHP CLI to another from the command window How To Run PHP From Windows Command Line in WAMPServer
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>
I've just starting working on a mac so this is probably very obvious.
I've installed php, pear, and lastly pecl.
My last command was sudo pecl install mongo and am prompted to add the line extension=mongo.so to php.ini configuration.
I am unable to locate the php.ini file. I do a quick php --ini in the CL and am told the path is /etc, /etc/php/apache2/php.ini to be exact. I've tried to unhide files and well as searching via the finder but am told these directories don't exist, even though I believe my installations were done correctly. How can I access this etc directory, as well as others like the php5 folder so I can edit my php.ini file? Thanks. Using Yosemite 10.10.3 and latest php packages.
Just check the phpinfo output to locate the loaded php.ini file (Loaded Configuration File).
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
Apache and my terminal are using two different php versions. The one that I installed via macports and the other is the one that comes with the mac.
My phpconfig tells me is using the mac one:
Configuration File (php.ini) Path /etc
Loaded Configuration File /etc/php.ini
And the Terminal version is using the one installed via macports:
php --ini
Configuration File (php.ini) Path: /opt/local/etc/php5
Loaded Configuration File: (none)
Scan for additional .ini files in: /opt/local/var/db/php5
Additional .ini files parsed: /opt/local/var/db/php5/intl.ini
How can I say to apache to load the macports version of php, and how can I change the "Loaded Configuration File" which is actually none?
UPDATE:
I solved how to Load the Conf file:
Copy the mac php.ini into /opt/local/etc/php5 (the "Configuration File (php.ini) Path") :
sudo cp /etc/php.ini /opt/local/etc/php5/
and how to change the php.ini that Apache is reading:
sudo nano /etc/apache2/httpd.conf
Just after the LoadModule php5_module add the line:
PHPINIDir "/opt/local/etc/php5/php.ini"
But I still have two different php running. So the question is how to say to apache to load my macports php?
UPDATE 2:
I've been reading for a solution and this is changing the path of the LoadModule php5 in the http.conf:
LoadModule php5_module /opt/local/apache2/modules/mod_php54.so
But actually I have no mod_php54.so in that folder.
The MacPorts documentation has a good step-by-step for setting up a MAMP install. I found it really useful when I went through the process.
https://trac.macports.org/wiki/howto/MAMP
Jump down to step four and look at the 'Register PHP with Apache' section. There are also quite a few other steps that you might need to study. It looks like you've gotten some of them already.