Okay, I've been having issues with PDO connection strings in a new VS.PHP 3.3 project.
I have found the main, apparent, cause of this is that in phpinfo() PDO drivers shows "no value".
Having scoured the net I followed all instructions and found the in php.ini
extension=php_pdo_mysql.dll
was remarked out. I unremarked and saved. This made no difference. I then noticed that
Loaded Configuration File linked to "E:\Website\Website\php.ini
which is the local project folder. Unable to see a file here I assumed it was hidden and, sure enough, when I showed the hidden file, there it was. I opened and noticed that, as above, the extension was remarked out. I amended, saved, re-ran phpinfo() and there was no change. In going back into the local php.ini all changes had reverted back.
I have changed the three php.ini files that are saved in "PHP 5.2", "PHP 5.3" and "PHP 5.4" and none of them reflect the local php.ini.
I have no idea where to go next. Really hoping someone can point out my deliberate mistake.
Panic over, problem solved.
For anyone who suffers from the same problem, this is how it is solved....
In the PHP 5.4 directory there is a config file "php-xdebug". This is where you need to change the extensions. This is where VS was overwriting from.
Related
First, this is my first post & I have spent the last five hours trying to read all I can to solve this.
I am new to PHP/mySQL, on Windows, using MAMP, PHP version 7.4.1 and trying to access phpMyAdmin, which gave me the famous error "the mysqli extension is missing", that is why I started researching on this.
After trying every solution I found on the internet (uncommenting lines in php.ini, running a script to see if extensions were loading, downgrading to PHP version 7.3.7, uninstalling & reinstalling MAMP, etc) and running many tests I finally understood part of the problem I was having :
• every time I set php.ini to display errors (deleting the ";" before the two lines & setting display_errors on "On"), it mysteriously changes the extension_dir I can see in the php.info page to another directory. I can't change it back using php.ini (it doesn't work), thus the extension mysqli.dll won't load (I can check it doesn't with a script). I have tried putting it in a new directory I created to match the path it said, but it doesn't work either.
• when I revert the php.ini file to not displaying errors (that is, when I add the two ; back where they were before), the extension_dir changes back to the right repertory and it works! The extensions load and I can access phpMyAdmin.
It doesn't make any sense at all to me. Maybe deleting just one ";" in the php.ini causes the extension_dir to change to something else, but I don't get why, especially when every php tutorial I've read tells me that it's the way to displaying errors.
I would like to keep seeing my code errors AND access phpMyAdmin via MAMP, and at this point my brain feels like mashed potatoes, so if you have any idea of what is going on here...
Alright I found what caused the problem and it was text in the php.ini I forgot to remove!
I was having problems with my PHP website (SuiteCRM) not being able to log users in and I found it was due to not being able to write on the sessions directory.
I am able to fix it by creating the directory /tmp/php_sessions and giving it write permissions for the Apache user www-data. I see the directory get populated with files as users log in.
However, Ubuntu Xenial is deleting my entire tmp directory on reboots, so I have to redo this all over again every time. I decided to move my save_path elsewhere.
After changing things in my php.ini file, and restarting Apache, I can check that they are effective by running this simple script:
<?php
echo ini_get("session.save_path");
phpinfo();
?>
This shows me a double confirmation of the new path, first echoing /var/tmp/php_sessions and then, in the middle of all the phpinfo information, showing the same value as both Local Value and Master value for directive session.save_path.
BUT the directory that php is using is still the first one, /tmp/php_sessions! It seems that my setting is being ignored.
Am I overlooking something? Where could that old setting be buried? Or how can I make the new one effective?
(P.S. - I am not using a redis handler as in another similar SO question)
Ok, I solved my own problem and the general answer is as follows:
There are two more things that can be changing the path and need to be checked,
the PHP code of the application might be changing the ini directive, search the code for ini_set(session.save_path
the PHP code might be using the session_save_path PHP command to override the ini. Search the code for that also (and notice the two underscores _!)
And the specific answer for my case was that SuiteCRM uses session_save_path command to set its path with a value coming from the file config.php found at the web root. That's where I found the old setting, and changing it solved my problem (for good, I hope).
This is my second post (original https://stackoverflow.com/questions/33463744/php-not-loading-extensions-or-anything-from-php-ini) - Im new to this whole thing and accidently hit answer instead of reply.
I am running on a mac with apache loaded from xampp.
Im trying to get an extension (ZMQ) loaded in php. It is loaded fine in the terminal php (checking it with php-i). However in a browser it is not loaded. I edited the php.ini (based on the location of the php.ini (as said in path from phpinfo) and no matter what I do it doesnt load. It actually seems like editing the php.ini file does nothing.
I have restarted the apache server. Any ideas,
Thanks so much for your help, JB
I have MAMP up and running and can run php in my browser, but when i attempt to connect to a MySQL database the connection fails. How do I correct this? I have read that to fix this I need to "enable php_mysqli extension in PHP.ini. It’s disabled by default. look for the following line: extension=php_mysqli".
I attempted this but i have multiple PHP.ini files and the first one i clicked on did not even have the line "extension=php_mysli".
I would like to know how to fix this problem so that i can test websites on my computer and not have to upload to a web server, also once everything is set up properly what are the correct parameters for the mysqli_connect() function?
Just installed MAMP to help you, and there is no php.ini in MAMP folder.
There is just 1 file php.ini in folder:
C:\MAMP\conf\php5.6.3\
since php5.6.3 is default version for my MAMP installation.
for my MAMP installation default user for MySQL is root and password root
I had this problem, my mysqli() function seemed to not be working after using it on multiple online servers. But not on MAMP! I followed all above instructions, looking in the php.ini files.
My fix...
I had my MAMP PHP version set to 7.0.0 (standard from install)
I changed this back down to 5.6.13 to test and everything started working correctly!
Im really not sure what caused it, or how to fix it to work with higher php versions.
Maybe something fundemental has changed since version 5.6.13.
Hope this helps someone! and please respond if you know why my problem is happening!
I have searched this error in Google and tried everything I found, but it still does not work.
I have set in my php.ini
extension_dir ="C:\php\ext\"
uncommented
extension=php_mysql.dll
extension=php_mysqli.dll
these files are present in the extension path, and I restarted Apache.
But phpinfo(); still does not show anything about MySQL. So do you have any suggestions to load these modules?
note: I am using Windows 7 (64 bit), MySQL 5.5, Apache 2.0.49 and PHP 5.3.16
Finally, I solved the same problem, so, here is my solution. I guess the last slash in the line
extension_dir ="C:\php\ext\
could make troubles. Just let it as
extension_dir ="C:\php\ext
Moreover, try to approach the problem the following way:
*My PC is running Windows 7 (Apache 2.2 & PHP 5.2.17 & MySQL 5.0.51a), the syntax in the file "httpd.conf" (C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf) was sensitive to slashes.
You can check if "php.ini" is read from the right directory. Just type in your browser "localhost/index.php". The code of index.php is the following:
<?php
echo phpinfo();
?>
There is the row (not far from the top) called "Loaded Configuration File". So, if there is nothing added, then the problem could be that your "php.ini" is not read, even you uncommented (extension=php_mysql.dll and extension=php_mysqli.dll). So, in order to make it work I did the following step. I needed to change from
PHPIniDir 'c:\PHP\'
to
PHPIniDir 'c:\PHP'
Pay the attention that the last slash disturbed everything!
Now the row "Loaded Configuration File" gets "C:\PHP\php.ini" after refreshing "localhost/index.php" (before I restarted Apache2.2) as well as mysql block is there. MySQL and PHP are working together!*
I have been having the exact same problem as you. And I (literally) solved it 2 minutes ago.
I am running Apache 2.4 64 bit on Win 7.
The version of php I downloaded gave me two php.ini files:
1)php.ini-production and
2)php.ini-development
I thought that was all gravy and every time I made a change to one, I did the exact same thing to the other.
When I first encountered the problem I loaded index.php (on my local server) and looked at the sixth box from the top called "Loaded configuration file". It simple said "nothing."
I then referenced this page and found how PHP (once started) goes about looking for the php.ini file. I tried putting both the development and production (referenced above) files in all the directories that the above link specified. Nothing.
Then I thought, what the hell it's worth a shot, and changed the php.ini-production to just "php.ini".
Bam. It started working. Such a simplistic fix but I suppose it makes sense as to why Apache wasn't able to find "php.ini." The file didn't exist verbatim.
I really hope this helps, running into this problem sure sucked.
And I'm sorry if any of this seems patronizing because it is so simple. I always troubleshoot from this site and so many of the answers require more than a fundamental understanding of a subject, and since this seems like a problem(and a solution) that beginners will struggle with, I thought I would spell it out in a way that I would have appreciated 6 months ago.