having issues getting php to talk to mysql set up on a mac - - mysql

My friend has a mac - we got AMPPS set up so he can run Apache, PHP and MySQL.
We got it up running. I can talk to mysql using phpMyAdmin.
I am running codeigniter - its working fine - but I'm getting an error when it tries connect to the database
Fatal error: Call to undefined function mysqli_init() in
mysqli_driver.php on line 126
I have a feeling that I'm missing the mysql.so extension or module in the Apache install or the PHP install.
How do I install that on a mac, or which config file do I need to modify?

That error indicates that the mysqli.so module is not loaded. Check the results of phpinfo() to see where the configuration file is, and make sure the module's being included properly. Often times there is a separate ini file for each module that's separately installed.
Personally I'd stay away from mysqli and use something higher level like PDO. I'd also recommend installing something maintainable like MacPorts or Homebrew to run Apache/MySQL/PHP instead of a pre-packaged solution.

Related

loading the mysql module

I am 85 and trying to keep my brain active by converting a php/mysql page, that i wrote to node.js.
require 'mysql';
I have the nodejs server up and running. it delivers, correctly, an html page i wrote. i 'require fs' and get it but i cannot find a mysql module. when i npm mysql it fails with a warning of deprecation. my question is how can i get 'mysql' installed so that i can 'require' it? is there a 'mysql' module that i can downlod and place in the c:/nodejs/node_modules folder? Naive?
I have been learning node.js for months. Hopefully I can help:
Check your "package.json" in the code editor (VS Code/Atom).
Check whether "mysql" version in "dependencies" or not.
If no, go to terminal, type "npm install mysql".
After completion, it should have included in "dependencies".
Require mysql in your mysql database connection file (Example: const mysql = require("mysql");)
I think it should be working fine already.
You can always remove existing mysql by typing npm remove mysql in the terminal then go back to Step 3 to reinstall it.
Hope it helps. Thanks

MySql 8.0.15 install failure Invalid Server Template

This is my first MySql install from the ground up.
I am using Windows Server 2016, trying to install MySql 8.0.15. I am doing this to try and use it with php 7.3.1.
The install has all the listed prerequisites.
When I get the config section of mysql insstaller, it breaks on the first response with an error of "Beginning configuration step: Writing configuration file
Invalid server template
Ended configuration step: Writing configuration file"
The system event log has one error, "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{8D8F4F83-3594-4F07-8369-FC3C3CAE4919}
and APPID
{F72671A9-012C-4725-9D2F-2A4D32D65169}
to the user NT AUTHORITY\SYSTEM SID (S-1-5-18) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool."
But I'm not sure this is even the right troubleshooting path to start down.
Can you assist with some guidance?
I had the same problem with the
mysql-installer-web-community.
The mysql-installer-community was working without a problem.
The bottom link is the none web installer which was working.
For me initially when I was not accepting the initial update mysql pop-up then installer was not working, but once I accepted it. Then it successfully worked for me.
I have been able to install after getting the same error.
I have changed the credentials for the sql root.
By default, host is set to something like %ALL_HOST%. I changed to localhost.
I ended up uninstalling all mysql 8 components that had already installed.
Then went back and got the mysql installer 5.7.25.0. I think I had some trouble after that, but it wasn't the same error. I finally ended up installing mysql 8.0.15 by itself and it worked. Then I went back and did the connectors. Next the workbench. Finally docs and samples. Doing them one at a time seemed to go better. I am now up and running.
Here's what I did to fix the issue
completely removed mySQL Server and Workbench installations.
uninstalled the mySQL web installer. Restarted my computer.
ran the mySQL web installer again (only installing mySQL Server)
downloaded the mySQL Workbench installer to install Workbench separately

Error establishing database connection using wp-cli and xampp

I've got everything to work with WP-CLI on Windows running XAMPP. Or so I thought. When I try to execute the following command:
wp rewrite structure '/%postname%/'
I get the following error:
Error: Error establishing a database connection. This either means that the username and password information in your wp-config.php file is incorrect or we canÔÇÖt contact the database server at localhost. This could mean your hostÔÇÖs database server is down.
I've read that the PHP used needs to be correct (a usual explanation for this problem). Running wp --info yields the following results.
$ wp --info
PHP binary: C:\xampp\xampp-5.6.24\php\php.exe
PHP version: 5.6.24
php.ini used: C:\xampp\xampp-5.6.24\php\php.ini
WP-CLI root dir: C:\lib\wp-cli
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.0.0
I think that this looks correct. I can access the db from a browser, use WP normally, and even perform database commands using wp-cli. But for some reason, the rewrite command gives an error (as stated above). The fun thing is that it actually changes the permalink option, but I'm afraid that since it gives an error some other action is not performed correctly.
Changing the credentials in wp-config.php makes me unable to run db commands, so clearly it works at some level.
What might be wrong? I'm pretty clueless here!
The database is set up by using wp-cli and is accessed using the root account.
It turned out to be a bug in wp-cli, which the author is now working on.

SOCI MySQL problems on OS X

My project is trying to incorporate SOCI for easy MySQL database access from C++. One of my teammates created a running SOCI test program in linux using the MySQL backend with only this link in his CMake file:
target_link_libraries(MyExecutable ${SOCI_LIBRARY})
Under Mac, however, when I try to run the program it errors out on the session creation line:
session sql("mysql", "service...")
with this error:
Error: Failed to find shared library for backend mysql
I definitely have MySQL installed and I definitely built SOCI with MySQL support, the make for SOCI even says it found MySQL libraries.
Should a CMake project using SOCI with a MySQL backend also link against MySQL or the SOCI MySQL plugin? I have tried going down that route but end up getting different runtime errors, like:
dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: MyExecutable
Reason: image not found
Any help would be greatly appreciated, I can provide our test program if needed, thanks!

Symfony2 Doctrine2 MS SQL Server connection on WHM/CPanel

SEE UPDATE BELOW:
I'm using Symfony2/Doctrine2 on CPanel and I need to make a connection to a MS SQL Server database. I keep getting an error saying
could not find driver
I've tried to install FreeTDS on WHM/CPanel following these instructions:
http://forums.cpanel.net/f5/definitive-freetds-installation-instuctions-88561.html
I also added an additional option to the PHP compilation (all_php5) so it looks like this:
--with-mssql=/usr/local/freetds --with-pdo-dblib=/usr/local/freetds
I then also added an entry to my php.ini file (/usr/local/lib/php.ini) that says:
extension= "mssql.so"
I rebuilt Apache/PHP after making all these changes but I still get the error saying the driver cannot be found. Anybody have this setup and know what I'm missing?
UPDATE:
So, instead of compiling FreeTDS, I found some packages through yum which I installed. I did, however, compile .so files for both mssql.so and pdo_dblib.so. They are now both referenced in my php.ini that I know is getting loaded. I can successfully use the mssql_* functions but PDO is still not working for me. I still get the the "could not find driver" error. I no longer have an all_php5 file since I don't think I need it anymore since I just compiled the .so files. Is this correct? What else can I do to get PDO working? Here is a screenshot of my phpinfo() page: