PHP脚本导致所有内容崩溃,错误为500
我看过很多这样的帖子,但它们对我帮助不大,因为我对这方面还不熟悉。请记住,我为自己创建了这个脚本。主要问题是,当我在几分钟后运行脚本时,它会使所有内容崩溃,但它以前没有这样做。从某种意义上说,它似乎比以前拖延了很多时间。目前,我唯一的解决方法是将“刷新内容”设置为60秒,然后脚本运行的时间长得多,对我来说太慢了,速度非常慢,但运行了一段时间后,最终还是崩溃了PHP脚本导致所有内容崩溃,错误为500,php,wordpress,apache,phpmyadmin,Php,Wordpress,Apache,Phpmyadmin,我看过很多这样的帖子,但它们对我帮助不大,因为我对这方面还不熟悉。请记住,我为自己创建了这个脚本。主要问题是,当我在几分钟后运行脚本时,它会使所有内容崩溃,但它以前没有这样做。从某种意义上说,它似乎比以前拖延了很多时间。目前,我唯一的解决方法是将“刷新内容”设置为60秒,然后脚本运行的时间长得多,对我来说太慢了,速度非常慢,但运行了一段时间后,最终还是崩溃了 <?php set_time_limit(0); require_once '../wp-load.php'; require_on
<?php
set_time_limit(0);
require_once '../wp-load.php';
require_once'../wp-admin/includes/taxonomy.php';
global $wpdb;
$start = $_GET['start'];
$nextstart = $start + 1;
$query = $wpdb->prepare("SELECT id, anime_name2, wordpress_id FROM
1tmarz_animes WHERE wordpress_created='1' AND episode_created='0' ORDER BY
id ASC LIMIT $start,1");
$wpdb->query( $query );
if ( $wpdb->num_rows ) {
$post_data = $wpdb->get_results( $query, OBJECT);
echo '<pre>';
print_r($post_data);
echo '</pre>';
$importid = $post_data[0]->id;
$anime_name = html_entity_decode($post_data[0]->anime_name2);
$anime_id = $post_data[0]->wordpress_id;
$post_thumbnail_id = get_post_thumbnail_id( $anime_id );
$post_link = get_permalink( $anime_id );
echo 'thumb id: '.$post_thumbnail_id.'<br>';
echo 'post_link: '.$post_link.'<br>';
echo $anime_name.'<br>';
}
// create category
//$cid = wp_insert_term( $anime_name, 'category');
//$catid = $cid['term_id'];
echo 'cat olustur<br>';
$catid = wp_create_category($anime_name);
echo 'catid: '.$catid.'<br>';
// select episodes
$anime_content_episode = '';
$query2 = $wpdb->prepare("SELECT * FROM 1tmarz_episodes WHERE
animes_id='".$importid."' ORDER BY episode_name3 ASC");
$wpdb->query( $query2 );
if ( $wpdb->num_rows ) {
$episode_datas = $wpdb->get_results( $query2, OBJECT);
$kacepisode = count($episode_datas);
if ($kacepisode > 30) {
echo 'cok lan bu';
echo '<meta http-equiv="refresh"
content="1;URL=\'http://www.web.com/scrape/import_episode.php?
start='.$nextstart.'\'">';
exit;
}
foreach ($episode_datas as $episode_data) {
/*
echo '<pre>';
print_r($episode_data);
echo '</pre>';
*/
$episode_bolum = $episode_data->episode_name;
$episode_name = $anime_name.' '.$episode_bolum;
$downloadlink = $episode_data->downloadlink;
$embed = $episode_data->embed;
preg_match('/src="([^"]+)"/', $embed, $match);
$embed_link = $match[1];
$servers_array = unserialize($episode_data->servers);
/*
echo '<pre>';
print_r($servers_array);
echo '</pre>';
*/
echo $anime_name.'<br>';
echo $downloadlink.'<br>';
echo $embed_link.'<br>';
$embed_content= '[vc_row][vc_column][vc_column_text]
<div id="information"><a href="'.$post_link.'">Anime Information</a>
</div>
[/vc_column_text][/vc_column][/vc_row]';
$embed_content.='[vc_row][vc_column][vc_tta_tabs active_section="1"
no_fill_content_area="true"]';
$embed_content.= '[vc_tta_section title="Mirror 1"
tab_id="1494732255558-35fdcb11-d9bb0eae-d19849b1-22f8ac8e-df8b2398-
88ce3281"]
[vc_column_text]
[iframe src="'.$embed_link.'" allowfullscreen="true" frameborder="0"
scrolling="no" width="640" height="360"]
[/vc_column_text][/vc_tta_section]';
$serverk = 2;
foreach ($servers_array as $server_url) {
$embed_content.= '[vc_tta_section title="Mirror '.$serverk.'"
tab_id="1494732255558-35fdcb11-d9bb0eae-d19849b1-22f8ac8e-df8b2398-
88ce3281'.$serverk.'"][vc_column_text]
[iframe src="'.$server_url.'" allowfullscreen="true" frameborder="0"
scrolling="no" width="640" height="360"]
[/vc_column_text][/vc_tta_section]';
$serverk++;
}
$embed_content.='[/vc_tta_tabs][/vc_column][/vc_row]';
$new_post = array(
'post_title' => 'Watch '.$episode_name.' </br> English Subbed',
'post_content' => $embed_content,
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => 1,
'post_type' => 'post',
'post_category' => array($catid)
);
$post_id = wp_insert_post($new_post);
echo 'new id: '.$post_id.'<br>';
$reference = array();
$reference[] = array('reference' => '', 'type' => 'name', 'value' =>
'robots', 'content' => 'Index,Follow');
$reference[] = array('reference' => '', 'type' => 'property', 'value' =>
'og:type', 'content' => 'website');
$reference[] = array('reference' => '', 'type' => 'name', 'value' =>
'keywords', 'content' => $episode_name.', '.$episode_name.' English
Subbed, Watch '.$episode_name.', Stream '.$episode_name.',
'.$episode_name.' animetv, stream '.$episode_name.', '.$episode_name.'
HD, streaming '.$episode_name.' eng sub, '.$episode_name.',
'.$episode_name.' download, '.$episode_name.' full episode, stream
'.$anime_name.',' );
$mtm_data = serialize($reference);
update_post_meta( $post_id, '_yoast_wpseo_metadesc', 'Watch
'.$anime_name.' for free in 1080p HD' );
update_post_meta( $post_id, '_yoast_wpseo_focuskw', $anime_name );
update_post_meta( $post_id, '_yoast_wpseo_focuskw_text_input',
$anime_name );
update_post_meta( $post_id, '_thumbnail_id', $post_thumbnail_id);
update_post_meta( $post_id, 'mtm_data', $mtm_data);
update_post_meta( $post_id, '_wpb_vc_js_status', 'true');
update_post_meta( $post_id, '_vc_post_settings', 'a:1:
{s:10:"vc_grid_id";a:0:{}}');
update_post_meta( $post_id, '_subbed', 'field_58fa509a036d2');
update_post_meta( $post_id, 'subbed', 'Subbed');
update_post_meta( $post_id, '_download', 'field_5917d34221664');
update_post_meta( $post_id, 'download', '<a href="'.$downloadlink.'"
target="_blank">Link</a>');
update_post_meta( $post_id, 'subbed', 'Subbed');
update_post_meta( $post_id, 'subbed', 'Subbed');
$episode_link = get_permalink( $post_id );
$anime_content_episode.= '<tr>
<td>'.$episode_bolum.'</td>
<td><a href="'.$episode_link.'">Link</a></td>
</tr>';
sleep(1);
}
} else {
echo 'ee yokmus';
echo '<meta http-equiv="refresh"
content="1;URL=\'http://www.web.com/scrape/import_episode.php?
start='.$nextstart.'\'">';
exit;
}
// DELETE n1 FROM 1tmarz_episodes n1, 1tmarz_episodes n2 WHERE n1.id >
n2.id AND n1.episode_url = n2.episode_url
$anime_content_html = '<table>
<tbody>
<tr> </p>
<p><b>Links</b></li>
<tr>
<td>Quality:</td>
<td>1080p</td>
<td></td>
</tr>
'.$anime_content_episode.'
</tbody>
</table>';
$content_post = get_post($anime_id);
$contento = str_replace('%episode_list%', $anime_content_html,
$content_post->post_content);
$my_post = array(
'ID' => $anime_id,
'post_content' => $contento
);
wp_update_post( $my_post );
$query = $wpdb->prepare("UPDATE 1tmarz_animes SET episode_created='1'
WHERE id='".$importid."'");
$wpdb->query( $query );
echo 'bitti '.$anime_id.'<br>';
?>
<meta http-equiv="refresh" content="1">
这是无效的PHPn2.id和n1.eposition\u url=n2.eposition\u url
,您似乎无法对其进行注释。另外,使用准备好的语句。如果没有错误信息,我无法确定问题的答案。我相信是我把帖子搞乱了。代码中很好。你所说的准备好的语句是什么意思。请记住,我并没有创建这个lolCheck您的错误日志。第一个错误是到处都是的PHP警告:wpdb::prepare()缺少参数2,在第9行的/home/admin/web/test.com/public_html/scrape/import_eption.PHP中调用,在第1291行的/home/admin/web/test.com/public_html/wp-includes/wp-db.PHP中定义,referer:PHP警告:发送查询数据包时出错。第1877行/home/admin/web/test.com/public_html/wp-includes/wp-db.php中的PID=30490,参考: