Job php-mysql-connect-error-database-repair · revised 9 October 2026
Fix “undefined function mysql_connect” on an old PHP website
Replace removed mysql_* database calls in one old custom PHP site with mysqli or PDO, then test its data-entry and login flows on a copy.
You might be seeing
- The website shows “Call to undefined function mysql_connect()”
- Pages load but customer records are blank
- The host says old mysql_* calls no longer work
No passwords, keys, card details or admin invites needed to start.
What usually happened
PHP removed the old mysql extension in PHP 7. A PHP 5 site whose database layer still calls mysql_connect, mysql_query or related functions cannot read or write its MySQL tables when the host switches versions. Unlike a routine PHP 7→8 compatibility change, every affected query and its error handling must be converted carefully.
Who it’s for: Owner of a custom PHP website that stopped showing data after a host changed PHP, with no developer to update the database code.
Usually starts when: The host moves the site from PHP 5 to PHP 7 or 8 and pages show “Call to undefined function mysql_connect()”.
The result: The old site connects on the host’s supported PHP runtime and every agreed read and write flow works on a copy, with changed database code and rollback instructions handed over.
Check whether this job fits
Four short questions. Your answers stay on this page unless you choose to email them.
Checks you can run yourself
Read the error log
Most control panels have an Errors or Logs page; your host can also send the PHP error log.
Look for: “Call to undefined function mysql_connect()” or another name starting mysql_. Names starting mysqli_ point to a different fault.
Count the old database calls
Ask the site holder to search the source for mysql_* calls. A text search may include comments and vendor libraries, and multiple calls can appear on one line; it is only a clue, not the price-scope count.
Look for: Ask the site holder for the number of executable old database calls in the site’s own code, not a count of matching lines. We check that number before quoting.
What you get
- Inventory of the removed database calls and their replacement
- Changed code and before/after results for the five agreed flows
- Switch-over and switch-back steps for the site holder
Included
- One custom PHP site on PHP 5 with up to 30 mysql_* call sites and one MySQL database
- Convert database connections and queries to mysqli or PDO with prepared parameters for inputs
- Test up to five data-reading and data-writing flows on a copy
- A handover with the changed files, test results and steps to switch the host’s PHP version
Not included
- WordPress or a maintained CMS
- A full PHP 8 compatibility upgrade across the entire application; other PHP 5 APIs may need their own scope
- Database schema redesign or a move to another host
- More than 30 call sites or a second database
How we know it’s done
Agreed with you before work starts. Each check produces evidence you keep.
A scan of the patched source finds no executable mysql_* calls in the agreed code paths
Evidence: Search results and changed-file list
On the target PHP version, each agreed read flow returns the same test data as on the PHP 5 copy
Evidence: Before/after screenshots and database query checks
Each agreed write flow stores a legitimate apostrophe-containing test value literally once, and an SQL-metacharacter input does not change any unintended row or query structure
Evidence: Saved test values and before/after row counts, plus the reviewer’s prepared-statement check
The PHP error log shows no undefined mysql_* function error during the agreed flows
Evidence: Redacted log for the test window
Sign-off. The client checks the agreed before/after results and signs off after the authorised live holder performs the named live checks.
If it fails. If the agreed acceptance checks do not pass, the client does not pay, and keeps our findings and rollback steps.
When it fits, and when we stop
It fits when
- The host confirms the site ran on PHP 5 before the switch
- The error or code contains mysql_* calls, not just mysqli_* calls
- The source files and a safe database copy are available
- You can name the pages, login or forms that depend on the database
- If the host has removed PHP 5, a separate restorable old environment or a tested supported-runtime rollback is available before the live change
We stop and tell you if
- Source files are encoded or the database cannot be backed up
- Card details are stored in the database or another regulated data problem requires a specialist
- The code has more than 30 mysql_* call sites or multiple hidden database layers
- Fixing the mysql calls reveals unrelated PHP 5 APIs blocking the site on the new runtime
- The host has removed the old PHP runtime and no safe alternative rollback environment can be prepared
What could go wrong
Keep the old files and a database snapshot. If the host still offers PHP 5, your site holder may restore the old files and switch back after checking new writes. If PHP 5 is gone, rehearse an old-version container or alternate host under client control before cutover; without that rollback path, do not start the fixed job.
Scroll the table sideways to read it all.
| Risk | How we handle it |
|---|---|
| A mechanical replacement changes query results or leaves SQL injection holes | Convert calls with prepared parameters and compare actual read/write results, not just page status. |
| The new PHP version breaks unrelated PHP 5 code | Test named flows and stop for an agreed separate scope if another removed API blocks them. |
| A data copy contains customer information | Use sanitised fixtures where possible, isolated storage and deletion after sign-off. |
A second reviewer checks each converted query for injection and changed results, and confirms nothing still calls a removed function on the agreed paths.
How we deliver
We arrange the work and independent review, then show you the result against the agreed checks. You keep authority over your systems.
- Restore the copy on PHP 5 if possible and record each agreed read and write flow
- List every mysql_* call and the queries it runs
- Replace each call with mysqli or PDO, using prepared statements wherever a query takes visitor input
- Run the agreed flows on the target PHP version and compare results with the PHP 5 copy
- Independent review of every converted query and its error handling
- Hand over the changed files, results and the PHP switch and switch-back steps
This is a one-off job, not emergency cover or a subscription. We confirm eligibility, the total price, a start window and a delivery date before you accept. Work starts only after agreed inputs, secure access, any licences and necessary permissions are in place. Hosting, platform and supplier charges are excluded unless the written quote includes them. No charge or booking is created by an enquiry.
Need to keep it working?
After database-call repair, discuss checking the named read/write flows whenever the runtime or dependencies change.
Ongoing work is separately scoped and quoted: no monitoring, response-time guarantee or automatic subscription is included in this job.
Explore an ongoing engineering lane, or mention the responsibility you need in your enquiry.
What you can check
This is a new service. We have not delivered this job for a client yet.
Other ways to get this done
- Ask the host whether it offers paid extended support for PHP 5 as a short-term bridge; PHP 5 is no longer security-supported and staying on it is not a fix.
- If the site is small and rarely used, rebuilding the few pages and forms on a supported platform may be cheaper than maintaining all its old code.
Questions
Is this the same as a PHP 7 to PHP 8 upgrade?
No. PHP 7 removed mysql_* entirely. This job rewrites database calls from a PHP 5 site; the separate PHP 7→8 job fixes later compatibility changes.
Will this fix every problem on PHP 8?
Only the agreed database-dependent flows. We stop and tell you if other removed PHP 5 features need a separate upgrade.
Start with an email
Send us
- The exact error message or a screenshot with private data removed
- The old and new PHP versions the host shows
- The pages and forms that need database data
- Whether the host can export the files and MySQL database
Later, once you agree
- A controlled copy of source files and a sanitised database export
- A test login if an agreed flow requires one
- Your host’s staging PHP version and someone who can switch live PHP
- A company-controlled secure handoff agreed before access: no live passwords, keys, private code or customer records by ordinary email.
The client owns the accounts, domain, live system and keys. An AI agent prepares the change using only an authorised test copy or read-only information; a separate reviewer checks the risks, and the client or their site holder approves any live change. Synthetic Industry is owned by a person and remains accountable for the agreed work. We never ask for passwords in the first enquiry.
Or write to hello@syntheticindustry.ai with “php-mysql-connect-error-database-repair” as the subject.