0

I developed a WordPress site for running on IIS with PHP FastCGI, that works.

I found that website is so slow, so tried to test it under Apache.

Now I have an installed WordPress site, IIS, Apache and 2 different php installation.

1 PHP is Non-Thread-Safe PHP (V7.4.9) that will be called by IIS FastCGI module and works correctly.

Another is ThreadSafe PHP (V7.4.9) that will be called from Apache and works but not for mysql.

When I execute code under Apache (localhost:81) it produces below error:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\Website\wp-includes\wp-db.php:1670 
Stack trace: 
#0 D:\Website\wp-includes\wp-db.php(632): wpdb->db_connect() 
#1 D:\Website\wp-includes\load.php(476): wpdb->__construct('DB_USER_VAL', 'DB_PASS_VAL', 'DB_NAME_VAL', '127.0.0.1') 
#2 D:\Websites\Navand\wp-settings.php(124): require_wp_db() 
#3 D:\Website\wp-config.php(92): require_once('D:\\Website...') 
#4 D:\Website\wp-load.php(37): require_once('D:\\Website...') 
#5 D:\Website\wp-blog-header.php(13): require_once('D:\\Website...') 
#6 D:\Website\index.php(17): require('D:\\Website...') 
#7 {main} thrown in D:\Website\wp-includes\wp-db.php on line 1670

Note:

  • Apache PHP works correctly when calling phpinfo()
  • extension_dir has been set for both php installations
  • both php_mysql and pdo_mysql are enabled for both php installation
  • both php.ini files are same (checked by WinMerge)

Why calling same mysql functions on Apache and TS-PHP generates error, but works correctly on IIS? and how can I resolve this problem (as I can not change WordPress source)

Homayoun Behzadian
  • 1,053
  • 9
  • 26
  • It's interesting the message states that `mysql_connect()` is undefined in only 1 setup. The `mysql_` api was removed as of PHP 7.0 (released December 2015) https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php. – Nigel Ren Aug 16 '20 at 07:19
  • Marking this as answered by this existing question as identified by the question author: [PDO drivers no value in Windows](https://stackoverflow.com/questions/7086859/pdo-drivers-no-value-in-windows) – FluffyKitten Aug 16 '20 at 11:43

1 Answers1

0

Surprise! According to answer https://stackoverflow.com/a/14786808/1441476, using absolute extension dir in php.ini for version that runs under apache, worked for me (extension_dir = "C:/Programs/php/php-7.4.9-Win32-vc15-x64/ext" instead of extension_dir = "ext")

Homayoun Behzadian
  • 1,053
  • 9
  • 26