This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide. Alternatives to this function include:
mysqli_connect()
PDO::__construct()
那么我们以前的老程序如何兼容,这里我们提供一个思路。
//$dbhost = DATA_HOST;
$dbport = 3306;
//$dbuser = DATA_USERNAME;
//$dbpass = DATA_PASSWORD;
//$dbname = DATA_NAME;
if(!function_exists('mysql_connect')){
function mysql_connect($dbhost, $dbuser, $dbpass){
global $dbport;
global $dbname;
global $mysqli;
$mysqli = mysqli_connect("$dbhost:$dbport", $dbuser, $dbpass, $dbname);
return $mysqli;
}
function mysql_select_db($dbname){
global $mysqli;
return mysqli_select_db($mysqli,$dbname);
}
function mysql_set_charset($character)
{
global $mysqli;
return mysqli_query($mysqli, "set names {$character}");
}
function mysql_fetch_array($result){
return mysqli_fetch_array($result);
}
function mysql_fetch_assoc($result){
return mysqli_fetch_assoc($result);
}
function mysql_fetch_row($result){
return mysqli_fetch_row($result);
}
function mysql_query($query){
global $mysqli;
return mysqli_query($mysqli,$query);
}
function mysql_escape_string($data){
global $mysqli;
return mysqli_real_escape_string($mysqli, $data);
}
function mysql_real_escape_string($data){
return mysql_real_escape_string($data);
}
function mysql_close(){
global $mysqli;
return mysqli_close($mysqli);
}
function mysql_error(){
global $mysqli;
return mysqli_connect_error();
}
function mysql_num_rows($data){
global $mysqli;
return mysqli_num_rows($data);
}
function mysql_affected_rows(){
global $mysqli;
return mysqli_affected_rows($mysqli);
}
}
hecking for libxml-2.0 >= 2.7.6… no configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met: No package ‘libxml-2.0’ found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBXML_CFLAGS and LIBXML_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
configure: error: Package requirements (sqlite3 > 3.7.4) were not met: No package ‘sqlite3’ found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SQLITE_CFLAGS and SQLITE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
apt-get install libsqlite3-dev
No package ‘oniguruma’ found
configure: error: Package requirements (oniguruma) were not met: No package ‘oniguruma’ found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables ONIG_CFLAGS and ONIG_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
一开始出现了Your PHP installation appears to be missing the MySQL extension which is required by WordPress.错误,是我们没有带上mysql的扩展--with-mysqli --with-pdo-mysql,以上编译时,我们已经带上了。
REPLACE INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT
id,
'_wp_page_template',
'single-with-sidebar'
FROM
wp_posts
WHERE
post_status = 'publish'
AND post_parent = 0
AND post_type = 'post';