Is it possible to make changes in mysql's my.ini file using PHP script?
ini file for MySQL Server on Windows Machine. In you have default installation on Windows machine for MySQL Server, you will be able to find the my. ini file in C:\ProgramData\MySQL\MySQL Server XX\. The XX defined the version of MySQL server.
First go to C: drive and then hidden folder of program data. From that, move to the MySQL version directory. Here is the my. ini file.
Sure - it's just a text file.
However, you would have to locate the correct INI file, stop the mySQL service, make the change, and start the service again. That's going to be tough. Your PHP script would probably need root privileges to stop and restart the service, and a PHP script should never have root privileges.
Update: A combination of these should work:
PHP commands to change the file: (enter www.php.net/commandname to be redirected to the manual)
fopen()
fwrite
fclose
PHP command to execute an external command:
exec()
Windows commands to stop and restart a service: net stop
/ net start
As to how to locate the my.ini programmatically, I have no idea. If you can, set that manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With