-
Posts
9153 -
Joined
-
Last visited
-
Days Won
146
Everything posted by Byron
-
HTTP Header Cache Control...
Byron replied to RJ Consulting's topic in Website Management and Coding
No mod_deflate is not enabled but you can use this on any of your pages that end in .php Insert this at the very top of your page: <?php ob_start("ob_gzhandler"); ?> -
If the script isn't generating any kind of html output then cron doesn't send an email. Look for this in the script: # write new file $day = date("l"); file_put_contents("$day.$fname", $result); and add this below it: echo "Backup File Successful"; So then it looks like # write new file $day = date("l"); file_put_contents("$day.$fname", $result); echo "Backup File Successful"; Then try it with Hotmail or another email service.
-
If you go here you'll see where I'm grabbing the gzipped backup file and where it gets restored also. http://stevie.heliohost.org:2082/frontend/...ckup/index.html You might want to set it up some where in your public_html directory at first just for testing so you can run the script without using a cron. Then once you've got it like you want it, move it to your home directory and call it from there with a cron job. The backup file will be a gzipped file stored in the same directory as the script is run in. Also don't forget that the username and password are your cpanel login and not your database user and pass.
-
If you don't want that script to email you the backup and instead write it to a directory, replace the email part with this: $day = date("l"); file_put_contents("$day.$fname", $result); And have a cron job run it every day. I can't remember the exact setting for every day, but the path will look something like this: php -q /home1/username/public_html/cron_job.php Here's the entire code that needs editing for your domain and username and password and dtabase info. It will over write each day every 7 days (Sunday, Monday, Tuesday, etc). <?php # Edit cPanel backup info # login is cPanel login username and password $user_name = "byron"; $user_pass = "********"; $database = "byron_test"; $domain = "byron.heliohost.org"; $url = "http://$domain:2082/getsqlbackup/$database.sql.gz"; $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $cook_file = "curl_login_cookie.txt"; # get file extension $extract = pathinfo($url); $fname = ($extract['basename']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_REFERER, "http://$domain"); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, true); curl_setopt($ch, CURLOPT_USERPWD, "$user_name:$user_pass"); curl_setopt($ch, CURLOPT_COOKIEFILE, $cook_file); curl_setopt($ch, CURLOPT_COOKIEJAR, $cook_file); $result = curl_exec($ch); $extract = curl_getinfo($ch); $httpcode = $extract['http_code']; curl_close($ch); if ($httpcode >= 200 && $httpcode < 303) { # write new file $day = date("l"); file_put_contents("$day.$fname", $result); } else { echo "cPanel Login Failed!"; } # delete cookie file if (file_exists($cook_file)) { unlink($cook_file); } ?> Here's what the setting would look like for 1900 hours 00 19 * * * php -q /home1/username/public_html/cron.php >/dev/null 2>&1 This part keeps cron from sending you an email each time it runs: >/dev/null 2>&1
-
Does this account belong to you? banaanvraag.co.cc
-
This support request is being escalated to our root admin.
-
Would it really be that difficult to try it before you drive down there? I don't think anybody would realize much of a difference while rebooting than it is now. Today has REALLY been a bad day on Stevie. You do what you think is best. If you can stand it so can I.
-
All Johnny accounts seem to be down at the moment. Escalating...
-
You should be good to go now. Refresh your cache if you still see the suspended page.
-
I'm seeing your site ok. Refresh your browser's cache. I think Django still works on Stevie. Not sure what else though.
-
I hope your right because I'm happy with the server loads now but check out the loads right before the outage which was May 6th. http://byrondallas.heliohost.org/server_load_may.php?page=3 They were a little higher than they are now. Seems we really stay remarkably low now. Regardless, it may not have anything to do with it, but thought it worth mentioning.
-
Escalating to the root administrator. This must be a parked domain or an addon domain because I'm not seeing it in the database.
-
Since I've never really gotten into any advanced php programming, that's probably why I never heard about this.
-
Here's a better way to do it: <?php $images = glob("{*.jpg,*.JPG}", GLOB_BRACE); # shuffle array shuffle($images); # take one from the top $image = array_shift($images); # redirect to browser header("location:$image"); exit; ?> without redirecting to the browser (using imagick): <?php $images = glob("{*.jpg,*.JPG}", GLOB_BRACE); # shuffle array shuffle($images); # take one from the top $image = array_shift($images); header("Content-type: image/jpeg"); $img = new Imagick($image); echo $img; ?> btw, you code works fine if you remove all of that space. I tried this on my site without any errors: <?php error_reporting(0); header("Content-Type: image/jpg"); $d = scandir('.'); foreach($d as $f) if(substr($f,-4)==".jpg") $fs[] = $f; readFile($fs[rand(1,count($fs))-1]); ?> @Geoff: I've never read anywhere that it is good practice to omit the php closing tag. I'm not saying your wrong, but could you provide documentation to this? EDIT: Nevermind Geoff, I did a search and found some arguments about leaving off the php closing tag. I myself would rather just remove the white space to keep from getting the dreaded "headers already sent" error myself. http://activeblogging.com/info/can-you-lea...ur-source-code/
-
Something I've noticed since the power outage is that the server load has been extremly low ALL the time. Most of the time under 6 or 7. It's never been that low since we had all of the users we have. http://byrondallas.heliohost.org/server_load.php Does that tell you anything? Could it be it's not returning the correct server load?
-
@cl58tools: I went ahead and deleted his account before I saw your post. His last login was 3-13-11 I believe so I know it's been inactive for quite some time. he should be able to signup now without any problems.
-
Ok try registering now.
-
I'm sorry I should have stated that the: $user_name $user_pass variables were cPanel username and password and not your database username and password. Your getting that login page because login failed. I should have added a check to verify login. I've edited my code to check for login now. Copy the code again and edit for your site and try it again.
-
[Solved] not able to access my website it says "server not found"???
Byron replied to fconnect's topic in Escalated Requests
Seems your site has entered the "Twilight Zone". Give it another 24 hours and post back if you still can't see it. -
Were you able to access your email before you did any altering? What kind of altering did you do?
-
I can't say that this works for certain because I don't have a large database to try it with. Give it a try on your site and when it emails the attachment to you make sure you open it up to see that everything is there. Als I'm sure some of the curl options aren't needed but they're not hurting anything either. Either download the text file or copy the script below: http://heliohost.uni.cc/auto_mysql_backup.txt <?php # Edit email info $to = "Byron <byron@gmail.com>"; $from = "Automated Backup <byron@byron.heliohost.org>"; $subject = "Mysql Backup"; $message = "Your Mysql GZIP Backup"; # Edit cpanel backup info # login is cpanel login username and password $user_name = "byron"; $user_pass = "********"; $database = "byron_test"; $domain = "byron.heliohost.org"; $url = "http://$domain:2082/getsqlbackup/$database.sql.gz"; $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $cook_file = "curl_login_cookie.txt"; # get file extension $extract = pathinfo($url); $fname = ($extract['basename']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_REFERER, "http://$domain"); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, true); curl_setopt($ch, CURLOPT_USERPWD, "$user_name:$user_pass"); curl_setopt($ch, CURLOPT_COOKIEFILE, $cook_file); curl_setopt($ch, CURLOPT_COOKIEJAR, $cook_file); $result = curl_exec($ch); $extract = curl_getinfo($ch); $httpcode = $extract['http_code']; curl_close($ch); if ($httpcode >= 200 && $httpcode < 303) { ####### Email gzip attachment ####### $content = chunk_split(base64_encode($result)); $uid = md5(uniqid(time())); $header = "From: $from\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message."\r\n\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-Type: application/x-gzip; name=\"".$fname."\"\r\n"; $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$fname."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; mail($to, $subject, $message, $header); ####### End email attachment ######## } else { echo "cPanel Login Failed!"; } # delete cookie file if (file_exists($cook_file)) { unlink($cook_file); } ?>
-
Yes auto backups has been disabled at the cpanel. Why don't you post your script and I'm sure somebody can show how to get around the system() function. If not I can show you how to get the source of the database gz file through curl and you can do whatever with the source you want.
-
Hate to say this djbob but I'm still seeing the same problems, "Slow to Load & Service Unavailable". What's weird about it is the server load has been unusually low all this time. Like under 6 or 7, sometimes under 4.
