This topic is locked

mysql_connect() Uncaught Error

7/8/2025 11:38:41 AM
PHPRunner General questions
P
pauls99 author

I am using PHPRunner version 10.9. I just moved to a new server that uses PHP version 8. When accessing my project, I get an error that says: "Fatal error: Uncaught Error: Call to undefined function mysql_connect() in ...". I think this has to do with the fact that mysql functions are not defined in PHP 8, instead using mysqli. But shouldn't this be accounted for by version 10.9 of PHPRunner?

Thank you

ChatGPT 7/8/2025

Yes, you are correct that the error you're encountering is related to the fact that the mysql_connect() function is deprecated and removed in PHP 7 and later versions. Instead, PHP now uses the mysqli or PDO extensions for database interactions.

PHPRunner 10.9 does support mysqli, but it’s possible that your project settings or the code generated by PHPRunner is still using the older mysql functions. Here are a few steps you can take to resolve the issue:

  1. Check Database Connection Settings:

    • Open your PHPRunner project and go to the database connection settings. Make sure that it is configured to use mysqli instead of the deprecated mysql.


  2. Regenerate Code:

    • After ensuring that the database connection settings are correct, regenerate your code in PHPRunner. This will ensure that any new code uses mysqli instead of mysql.


  3. Update Project Files:

    • If you have custom code in your project that uses mysql functions, you will need to update those to use mysqli or PDO. Look for any instances of mysql_connect(), mysql_query(), etc., and replace them with their mysqli counterparts (e.g., mysqli_connect(), mysqli_query(), etc.).


  4. Check for Compatibility:

    • Ensure that your project is compatible with PHP 8. While PHPRunner 10.9 supports PHP 8, there may be other parts of your custom code that need adjustment to work properly with the new PHP version.


  5. Review Documentation:

    • Check the PHPRunner documentation or forums for any specific notes or patches related to PHP 8 compatibility.



If you've done all of the above and are still encountering issues, consider reaching out to PHPRunner support or checking their community forums for additional assistance specific to version 10.9 and PHP 8 compatibility.

Sergey Kornilov admin 7/9/2025

Make sure that mysqli extension is enabled in PHP settings, this the default connection method PHPRunner uses.