ballhogjoni Posted April 17, 2011 Share Posted April 17, 2011 I have a php script that calls another script. It seems that the 2nd script times out or something. I have tried setting max_execution_time to 120 seconds. how can I fix this? I open to anything. Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted April 17, 2011 Share Posted April 17, 2011 Can we see some relevant code? Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 17, 2011 Author Share Posted April 17, 2011 Sure thing... $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://".$_POST['domain']."/wp-admin/install.php?step=2&sitename=".urlencode($_POST['sitename']) ."&adminuser=".urlencode($_POST['adminuser'])."&adminemail=".urlencode($_POST['adminemail'])."&INST_password=".urlencode($_POST['INST_password']) ."&anchor_one=".urlencode($_POST['anchor_one'])."&anchor_two=".urlencode($_POST['anchor_two']) ."&anchor_three=".urlencode($_POST['anchor_three'])."&akismet=".urlencode($_POST['akismet']) ."&theme=".urlencode($_POST['theme'])); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $resp = curl_exec($ch); This calls the second script which is over 1200 lines of code. Don't know if you need to see that or not. Here is the code when the scripts stops running. $plugins = array( array("google-sitemap-generator","google-sitemap-generator/sitemap.php"), array("xml-sitemaps-for-videos","xml-sitemaps-for-videos/video-sitemap.php"), array("si-captcha-for-wordpress","si-captcha-for-wordpress/si-captcha.php"), array("ps-auto-sitemap","ps-auto-sitemap/ps_auto_sitemap.php"), array("wp-super-cache","wp-super-cache/wp-cache.php"), array("no-self-ping","no-self-ping/no-self-pings.php"), array("login-lockdown","login-lockdown/loginlockdown.php"), array("kb-robotstxt","kb-robotstxt/kb-robots-txt.php"), array("all-in-one-seo-pack","all-in-one-seo-pack/all_in_one_seo_pack.php"), array("searchterms-tagging-2","searchterms-tagging-2/searchterms-tagging2.php"), array("seo-automatic-links","seo-automatic-links/seo-links.php"), array("si-contact-form","si-contact-form/si-contact-form.php"), array("simple-tags","simple-tags/simple-tags.php"), array("wp-minify","wp-minify/wp-minify.php"), array("jetpack","jetpack/jetpack.php"), array("wordpress-google-seo-positioner","wordpress-google-seo-positioner/position_yourself.php"), array("akismet","akismet/akismet.php"), array("redirection","redirection/redirection.php"), array("wp-missed-schedule","wp-missed-schedule/wp-missed-schedule.php"), array("better-blogroll","better-blogroll/better_blogroll.php") ); include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. foreach($plugins as $plugin) { $api = plugins_api('plugin_information', array('slug' => $plugin[0], 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. if ( is_wp_error($api) ) wp_die($api); $title = __('Plugin Install'); $parent_file = 'plugins.php'; $submenu_file = 'plugin-install.php'; $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ); $nonce = 'install-plugin_' . $plugin; $url = 'update.php?action=install-plugin&plugin=' . $plugin[0]; if ( isset($_GET['from']) ) $url .= '&from=' . urlencode(stripslashes($_GET['from'])); $type = 'web'; //Install plugin type, From Web or an Upload. $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); $upgrader->install($api->download_link); } this loop gets all the way to the akismet array and then stops. This code is lines 423-468. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 17, 2011 Author Share Posted April 17, 2011 ok i figured it out...it was the timeout from curl_setopt($ch, CURLOPT_TIMEOUT, 10); I set it to 60 and now it works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.