Guest User

Untitled

a guest
Apr 24th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.28 KB | None | 0 0
  1. set_error_handler("sqlErrorHandler");
  2. set_time_limit(12000);
  3.  
  4.  
  5. $link = mysql_connect("$MYSQL_Host","$MYSQL_User","$MYSQL_Pass");
  6. mysql_select_db($MYSQL_db, $link);
  7.  
  8. echo "mysql_ping = " . (mysql_ping($link) ? "LIVE" : "DEAD") . "<br /><br />";
  9.  
  10. $sql = "SELECT SLEEP(120);";
  11.  
  12. $start = microtime(true);
  13. mysql_query($sql, $link);
  14.  
  15. echo "**query done**<br />";
  16. allDone();
  17.  
  18. function allDone(){
  19. global $start, $sql;
  20.  
  21. $end = microtime(true);
  22. echo "sql : $sql<br />";
  23. echo "elapsed : " . ($end - $start) . "<br />";
  24. echo "<br />";
  25. }
  26.  
  27. function sqlErrorHandler($errno, $errstr, $errfile, $errline){
  28. global $link;
  29. echo "Error : $errno<br />$errstr<br />";
  30. echo "mysql_ping : " . (mysql_ping($link) ? "LIVE" : "DEAD") . "<br />";
  31. echo "<br />";
  32.  
  33. allDone();
  34. }
  35.  
  36. mysql_ping = LIVE
  37.  
  38. Error : 2
  39. mysql_query() [function.mysql-query]: MySQL server has gone away
  40. mysql_ping : DEAD
  41.  
  42. sql : SELECT SLEEP(120);
  43. elapsed : 60.051116943359
  44.  
  45. Error : 2
  46. mysql_query() [function.mysql-query]: Error reading result set's header
  47. mysql_ping : DEAD
  48.  
  49. sql : SELECT SLEEP(120);
  50. elapsed : 60.0511469841
  51.  
  52. **query done**
  53. sql : SELECT SLEEP(120);
  54. elapsed : 60.051155090332
  55.  
  56. Variable_name=Value
  57. auto_increment_increment=1
  58. auto_increment_offset=1
  59. autocommit=ON
  60. automatic_sp_privileges=ON
  61. back_log=50
  62. basedir=C:\Program Files\MySQL\MySQL Server 5.1\
  63. big_tables=OFF
  64. binlog_cache_size=32768
  65. binlog_format=STATEMENT
  66. bulk_insert_buffer_size=8388608
  67. character_set_client=utf8
  68. character_set_connection=utf8
  69. character_set_database=latin1
  70. character_set_filesystem=binary
  71. character_set_results=utf8
  72. character_set_server=latin1
  73. character_set_system=utf8
  74. character_sets_dir=C:\Program Files\MySQL\MySQL Server 5.1\share\charsets\
  75. collation_connection=utf8_general_ci
  76. collation_database=latin1_swedish_ci
  77. collation_server=latin1_swedish_ci
  78. completion_type=0
  79. concurrent_insert=1
  80. connect_timeout=10
  81. datadir=C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\
  82. date_format=%Y-%m-%d
  83. datetime_format=%Y-%m-%d %H:%i:%s
  84. default_week_format=0
  85. delay_key_write=ON
  86. delayed_insert_limit=100
  87. delayed_insert_timeout=300
  88. delayed_queue_size=1000
  89. div_precision_increment=4
  90. engine_condition_pushdown=ON
  91. error_count=0
  92. event_scheduler=OFF
  93. expire_logs_days=0
  94. flush=OFF
  95. flush_time=1800
  96. foreign_key_checks=ON
  97. ft_boolean_syntax=+ -><()~*:""&|
  98. ft_max_word_len=84
  99. ft_min_word_len=4
  100. ft_query_expansion_limit=20
  101. ft_stopword_file=(built-in)
  102. general_log=OFF
  103. general_log_file=C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\p1.log
  104. group_concat_max_len=1024
  105. have_community_features=YES
  106. have_compress=YES
  107. have_crypt=NO
  108. have_csv=YES
  109. have_dynamic_loading=YES
  110. have_geometry=YES
  111. have_innodb=YES
  112. have_ndbcluster=NO
  113. have_openssl=DISABLED
  114. have_partitioning=YES
  115. have_query_cache=YES
  116. have_rtree_keys=YES
  117. have_ssl=DISABLED
  118. have_symlink=YES
  119. identity=0
  120. ignore_builtin_innodb=OFF
  121. init_connect=
  122. init_file=
  123. init_slave=
  124. innodb_adaptive_hash_index=ON
  125. innodb_additional_mem_pool_size=2097152
  126. innodb_autoextend_increment=8
  127. innodb_autoinc_lock_mode=1
  128. innodb_buffer_pool_size=96468992
  129. innodb_checksums=ON
  130. innodb_commit_concurrency=0
  131. innodb_concurrency_tickets=500
  132. innodb_data_file_path=ibdata1:10M:autoextend
  133. innodb_data_home_dir=D:\MySQL Datafiles\
  134. innodb_doublewrite=ON
  135. innodb_fast_shutdown=1
  136. innodb_file_io_threads=4
  137. innodb_file_per_table=OFF
  138. innodb_flush_log_at_trx_commit=1
  139. innodb_flush_method=
  140. innodb_force_recovery=0
  141. innodb_lock_wait_timeout=50
  142. innodb_locks_unsafe_for_binlog=OFF
  143. innodb_log_buffer_size=1048576
  144. innodb_log_file_size=19922944
  145. innodb_log_files_in_group=2
  146. innodb_log_group_home_dir=.\
  147. innodb_max_dirty_pages_pct=90
  148. innodb_max_purge_lag=0
  149. innodb_mirrored_log_groups=1
  150. innodb_open_files=300
  151. innodb_rollback_on_timeout=OFF
  152. innodb_stats_on_metadata=ON
  153. innodb_support_xa=ON
  154. innodb_sync_spin_loops=20
  155. innodb_table_locks=ON
  156. innodb_thread_concurrency=8
  157. innodb_thread_sleep_delay=10000
  158. innodb_use_legacy_cardinality_algorithm=ON
  159. insert_id=0
  160. interactive_timeout=28800
  161. join_buffer_size=131072
  162. keep_files_on_create=OFF
  163. key_buffer_size=50331648
  164. key_cache_age_threshold=300
  165. key_cache_block_size=1024
  166. key_cache_division_limit=100
  167. language=C:\Program Files\MySQL\MySQL Server 5.1\share\english\
  168. large_files_support=ON
  169. large_page_size=0
  170. large_pages=OFF
  171. last_insert_id=0
  172. lc_time_names=en_US
  173. license=GPL
  174. local_infile=ON
  175. log=OFF
  176. log_bin=OFF
  177. log_bin_trust_function_creators=OFF
  178. log_bin_trust_routine_creators=OFF
  179. log_error=C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\p1.err
  180. log_output=FILE
  181. log_queries_not_using_indexes=OFF
  182. log_slave_updates=OFF
  183. log_slow_queries=OFF
  184. log_warnings=1
  185. long_query_time=10.000000
  186. low_priority_updates=OFF
  187. lower_case_file_system=ON
  188. lower_case_table_names=1
  189. max_allowed_packet=1048576
  190. max_binlog_cache_size=4294963200
  191. max_binlog_size=1073741824
  192. max_connect_errors=10
  193. max_connections=800
  194. max_delayed_threads=20
  195. max_error_count=64
  196. max_heap_table_size=16777216
  197. max_insert_delayed_threads=20
  198. max_join_size=18446744073709551615
  199. max_length_for_sort_data=1024
  200. max_prepared_stmt_count=16382
  201. max_relay_log_size=0
  202. max_seeks_for_key=4294967295
  203. max_sort_length=1024
  204. max_sp_recursion_depth=0
  205. max_tmp_tables=32
  206. max_user_connections=0
  207. max_write_lock_count=4294967295
  208. min_examined_row_limit=0
  209. multi_range_count=256
  210. myisam_data_pointer_size=6
  211. myisam_max_sort_file_size=107374182400
  212. myisam_recover_options=OFF
  213. myisam_repair_threads=1
  214. myisam_sort_buffer_size=12582912
  215. myisam_stats_method=nulls_unequal
  216. myisam_use_mmap=OFF
  217. named_pipe=OFF
  218. net_buffer_length=16384
  219. net_read_timeout=30
  220. net_retry_count=10
  221. net_write_timeout=80
  222. new=OFF
  223. old=OFF
  224. old_alter_table=OFF
  225. old_passwords=OFF
  226. open_files_limit=2048
  227. optimizer_prune_level=1
  228. optimizer_search_depth=62
  229. optimizer_switch=index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on
  230. pid_file=C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\p1.pid
  231. plugin_dir=C:\Program Files\MySQL\MySQL Server 5.1\lib/plugin
  232. port=3306
  233. preload_buffer_size=32768
  234. profiling=OFF
  235. profiling_history_size=15
  236. protocol_version=10
  237. pseudo_thread_id=3230
  238. query_alloc_block_size=8192
  239. query_cache_limit=1048576
  240. query_cache_min_res_unit=4096
  241. query_cache_size=33554432
  242. query_cache_type=ON
  243. query_cache_wlock_invalidate=OFF
  244. query_prealloc_size=8192
  245. rand_seed1=
  246. rand_seed2=
  247. range_alloc_block_size=4096
  248. read_buffer_size=65536
  249. read_only=OFF
  250. read_rnd_buffer_size=262144
  251. relay_log=
  252. relay_log_index=
  253. relay_log_info_file=relay-log.info
  254. relay_log_purge=ON
  255. relay_log_space_limit=0
  256. report_host=
  257. report_password=
  258. report_port=3306
  259. report_user=
  260. rpl_recovery_rank=0
  261. secure_auth=OFF
  262. secure_file_priv=
  263. server_id=0
  264. shared_memory=OFF
  265. shared_memory_base_name=MYSQL
  266. skip_external_locking=ON
  267. skip_networking=OFF
  268. skip_show_database=OFF
  269. slave_compressed_protocol=OFF
  270. slave_exec_mode=STRICT
  271. slave_load_tmpdir=C:\WINDOWS\TEMP
  272. slave_net_timeout=3600
  273. slave_skip_errors=OFF
  274. slave_transaction_retries=10
  275. slow_launch_time=2
  276. slow_query_log=OFF
  277. slow_query_log_file=C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\p1-slow.log
  278. sort_buffer_size=262144
  279. sql_auto_is_null=ON
  280. sql_big_selects=ON
  281. sql_big_tables=OFF
  282. sql_buffer_result=OFF
  283. sql_log_bin=ON
  284. sql_log_off=OFF
  285. sql_log_update=ON
  286. sql_low_priority_updates=OFF
  287. sql_max_join_size=18446744073709551615
  288. sql_mode=
  289. sql_notes=ON
  290. sql_quote_show_create=ON
  291. sql_safe_updates=OFF
  292. sql_select_limit=18446744073709551615
  293. sql_slave_skip_counter=
  294. sql_warnings=OFF
  295. ssl_ca=
  296. ssl_capath=
  297. ssl_cert=
  298. ssl_cipher=
  299. ssl_key=
  300. storage_engine=InnoDB
  301. sync_binlog=0
  302. sync_frm=ON
  303. system_time_zone=Eastern Daylight Time
  304. table_definition_cache=256
  305. table_lock_wait_timeout=50
  306. table_open_cache=619
  307. table_type=InnoDB
  308. thread_cache_size=38
  309. thread_handling=one-thread-per-connection
  310. thread_stack=196608
  311. time_format=%H:%i:%s
  312. time_zone=SYSTEM
  313. timed_mutexes=OFF
  314. timestamp=1256827484
  315. tmp_table_size=16777216
  316. tmpdir=C:\WINDOWS\TEMP
  317. transaction_alloc_block_size=8192
  318. transaction_prealloc_size=4096
  319. tx_isolation=REPEATABLE-READ
  320. unique_checks=ON
  321. updatable_views_with_limit=YES
  322. version=5.1.36-community
  323. version_comment=MySQL Community Server (GPL)
  324. version_compile_machine=ia32
  325. version_compile_os=Win32
  326. wait_timeout=28800
  327. warning_count=0
  328.  
  329. ini_set('mysql.connect_timeout', 300);
  330. ini_set('default_socket_timeout', 300);
  331.  
  332. $link = mysql_connect("$MYSQL_Host","$MYSQL_User","$MYSQL_Pass");
  333. mysql_select_db($MYSQL_db, $link);
  334.  
  335. // RUN REALLY LONG QUERY HERE
  336.  
  337. // Reconnect if needed
  338.  
  339. if( !mysql_ping($link) ) $link = mysql_connect("$MYSQL_Host","$MYSQL_User","$MYSQL_Pass", true);
  340.  
  341. // RUN ANOTHER QUERY
Add Comment
Please, Sign In to add comment