Code is showing...server down

Status
Not open for further replies.
Messages
65
Reaction score
0
Points
6
Hi,

I need to know how to put up an server down page immediately. When you make updates to the server all my code is showing. I have backups and have to change my passwords. http://www.bagandabaguette.com/

Tell me the steps to make my own error page in x10hosting and where to place it in x10hosting in file manager so my customers see (server is down...come back later)

Also, I need to monitor how often the site is down. It can't be too much or else I will need to change my host. X10hosting is on the bottom of top 10 hosting sites. Please help to fix this.

Thanks,

Nicole
 

peppermi

Member
Messages
118
Reaction score
8
Points
18
In File the file manager make a index.html or index.php then input this code

HTML:
<html>

<head>
<title>HTML Reference</title>
</head>

<body>
The content of the document......
</body>

</html>
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hello Nicole,

When you make updates to the server all my code is showing.
This shouldn't happen. Should the MySQL service go down temporarily, it will output certain errors. If you wish to hide these errors, you can set the error_reporting() function at the top of your PHP script. For more information on how to use the error_reporting() function, please see this page on the PHP website.

For example, if I didn't want any errors to appear ever on my website, I would put this at the top of my PHP script:
Code:
error_reporting(0);

Alternatively, if you are using PDO, you can use a try/catch statement in your code to catch when an error occurs with the database connection and output your own custom error instead.

You can also define error pages for custom error codes by creating and editing a .htaccess file accordingly.

Thank you,
 
Messages
65
Reaction score
0
Points
6
In File the file manager make a index.html or index.php then input this code

HTML:
<html>

<head>
<title>HTML Reference</title>
</head>

<body>
The content of the document......
</body>

</html>

Where exactly to place in the file manager?
 
Messages
65
Reaction score
0
Points
6
Hello Nicole,


This shouldn't happen. Should the MySQL service go down temporarily, it will output certain errors. If you wish to hide these errors, you can set the error_reporting() function at the top of your PHP script. For more information on how to use the error_reporting() function, please see this page on the PHP website.

For example, if I didn't want any errors to appear ever on my website, I would put this at the top of my PHP script:
Code:
error_reporting(0);

Alternatively, if you are using PDO, you can use a try/catch statement in your code to catch when an error occurs with the database connection and output your own custom error instead.

You can also define error pages for custom error codes by creating and editing a .htaccess file accordingly.

Thank you,

Okay, thanks.

Nicole
 
Messages
65
Reaction score
0
Points
6
Okay, you mean write the code on the end of public_html? There are folders inside the public_html. Which folder inside that folder until I get to the sheet to write the code?
 

usama_rasab27

Member
Messages
208
Reaction score
15
Points
18
Public_Html contains all of your websites contents. So, index.html or index.php would be inside of public_html so that when you go to your website, you can see the contents of index.html or index.php
 
Messages
65
Reaction score
0
Points
6
I don't see index.html I see admin, catalog, cgi_bin, download, image, system. These are the folders I have inside of public_html. Where in these folders do I go to get to index.html in order to write the code?
 

usama_rasab27

Member
Messages
208
Reaction score
15
Points
18
Hi, you probably have index.php then. You also have a CMS (Content Management System), so if you edit the code, it could mess up your site unless you have a backup.

[EDIT]

Maintenance Mode

If you want to create a maintenance mode, then first create 2 new files in CPanel File Manager or FTP, in CPanel when you click File Manager, make sure to check 'Show hidden files'. Name one file maintenance.php and the other ip.php, then paste the following inside of maintenance.php:

Code:
<html>
<h2>Maintenance Mode! SORRY!</h2>
<?php include("ip.php"); ?>
</html>

You can change it if you want. Paste the following inside of ip.php:

PHP:
<?php
$ip = getenv(REMOTE_ADDR);

echo "Your IP Address is ".$ip;
?>

Then, go to your .htaccess file and add:

Code:
# MAINTENANCE-PAGE REDIRECT
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteCond %{REMOTE_ADDR} !^123\.456\.78\.90
RewriteCond %{REQUEST_URI} !/maintenance.php$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.php [R=302,L]
</IfModule>

Then, go to your website, it should automatically redirect you to the maintenance page. BUT, WE HAVEN'T FINISHED YET!

On the maintenance page, you should see your ip, it won't be the same as the one you see when you look on other websites. Copy it, then go back to .htaccess and on the 4th line, there is a '#' before 'RewriteCond, remove the '#', then on the same line after '^' replace the current i.p (It's not a real i.p address) with the one you copied and then before the dot's add a '\', only on that line, then save the file.

There you have a maintenance page, if you don't want to display the maintenance page, then just before the 'RewriteRule' line starts add a '#' before it, this comments out the line. if you want to see the maintenance page, then add a '#' on the 4th line, before the line starts. Now, all the files, folders, sub-folders, will redirect to the maintenance page.

You can remove the following code from the maintenance page if you want:
PHP:
<?php
include("ip.php");
?>

Then, you can customize maintenance.php, however you like.

NOTE: Your i.p address changes, so when it does, you will have to adjust .htaccess

Thank You
 
Last edited:

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hello Nicole,

Looking back at the posts, it looks like all you really want to do is set the Error Reporting values like I described in my last post.
I noticed you use OpenCart, which apparently has its own error system that you can configure.

So, you could just configure the Error Handling in OpenCart's admin panel to hide the errors.

stackoverflow.com said:
Admin->System->Settings->[edit your configured store]->Server->Display Errors

Thank you,
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Please note, though, that this is only a solution for database server (MySQL) errors or, at best, minor PHP module failures (where the PHP commands can be interpreted but can't be executed). If the server is down down, in the sense that the server isn't running/available, or LiteSpeed (the web server component) has crashed, or that there is something wrong with the primary PHP module (either it's down or LiteSpeed isn't invoking it for PHP pages), then you're dealing with a problem that can't be fixed in a single-server environment. You'd need something else in front of the web server to control errors, either a separate front-end server (that's an expensive option; you'll quickly find yourself in the $100+/month league) or a CDN like Cloudflare.

On a more realistic note, it really won't pay to try to run a business on anybody's free hosting service if that service allows scripting (like PHP) and databases. Unless, of course, you can tolerate a lot of down time (relatively speaking; a server that is up and running at peak only 95% of the time is still down or dog-slow more than 35 hours per month). You are paying nothing, thus you have no contract, and thus no SLA (service level agreement) — and you're at the mercy of all of the other users you're sharing the server with, many of whom haven't a clue what they're doing, or are trying to do naughty things, or are simply using software that really requires more resources than the Free Hosting servers have available. You get what you pay for, so if you want to make money, you really need to spend some yourself. A basic (Infinity) Premium hosting package is only $3.95/month if you pre-pay for 3 years ($142), and I'd suggest that if you can't afford to invest less than $150 dollars in your business, then you really don't have a business to invest in.
 
Messages
65
Reaction score
0
Points
6
Please note, though, that this is only a solution for database server (MySQL) errors or, at best, minor PHP module failures (where the PHP commands can be interpreted but can't be executed). If the server is down down, in the sense that the server isn't running/available, or LiteSpeed (the web server component) has crashed, or that there is something wrong with the primary PHP module (either it's down or LiteSpeed isn't invoking it for PHP pages), then you're dealing with a problem that can't be fixed in a single-server environment. You'd need something else in front of the web server to control errors, either a separate front-end server (that's an expensive option; you'll quickly find yourself in the $100+/month league) or a CDN like Cloudflare.

On a more realistic note, it really won't pay to try to run a business on anybody's free hosting service if that service allows scripting (like PHP) and databases. Unless, of course, you can tolerate a lot of down time (relatively speaking; a server that is up and running at peak only 95% of the time is still down or dog-slow more than 35 hours per month). You are paying nothing, thus you have no contract, and thus no SLA (service level agreement) — and you're at the mercy of all of the other users you're sharing the server with, many of whom haven't a clue what they're doing, or are trying to do naughty things, or are simply using software that really requires more resources than the Free Hosting servers have available. You get what you pay for, so if you want to make money, you really need to spend some yourself. A basic (Infinity) Premium hosting package is only $3.95/month if you pre-pay for 3 years ($142), and I'd suggest that if you can't afford to invest less than $150 dollars in your business, then you really don't have a business to invest in.

Depends what kind of business it is. Why pay when the server will go down anyway. I paid for websites before and they were slow and server down. I wasted money.

Please note, though, that this is only a solution for database server (MySQL) errors or, at best, minor PHP module failures (where the PHP commands can be interpreted but can't be executed). If the server is down down, in the sense that the server isn't running/available, or LiteSpeed (the web server component) has crashed, or that there is something wrong with the primary PHP module (either it's down or LiteSpeed isn't invoking it for PHP pages), then you're dealing with a problem that can't be fixed in a single-server environment. You'd need something else in front of the web server to control errors, either a separate front-end server (that's an expensive option; you'll quickly find yourself in the $100+/month league) or a CDN like Cloudflare.

On a more realistic note, it really won't pay to try to run a business on anybody's free hosting service if that service allows scripting (like PHP) and databases. Unless, of course, you can tolerate a lot of down time (relatively speaking; a server that is up and running at peak only 95% of the time is still down or dog-slow more than 35 hours per month). You are paying nothing, thus you have no contract, and thus no SLA (service level agreement) — and you're at the mercy of all of the other users you're sharing the server with, many of whom haven't a clue what they're doing, or are trying to do naughty things, or are simply using software that really requires more resources than the Free Hosting servers have available. You get what you pay for, so if you want to make money, you really need to spend some yourself. A basic (Infinity) Premium hosting package is only $3.95/month if you pre-pay for 3 years ($142), and I'd suggest that if you can't afford to invest less than $150 dollars in your business, then you really don't have a business to invest in.
lol, depends what kind of business it is. I'm not paying for a website that will be slow and have downtown anyway. Besides, 10xhosting is at the bottom of top ten free hosting
Please note, though, that this is only a solution for database server (MySQL) errors or, at best, minor PHP module failures (where the PHP commands can be interpreted but can't be executed). If the server is down down, in the sense that the server isn't running/available, or LiteSpeed (the web server component) has crashed, or that there is something wrong with the primary PHP module (either it's down or LiteSpeed isn't invoking it for PHP pages), then you're dealing with a problem that can't be fixed in a single-server environment. You'd need something else in front of the web server to control errors, either a separate front-end server (that's an expensive option; you'll quickly find yourself in the $100+/month league) or a CDN like Cloudflare.

On a more realistic note, it really won't pay to try to run a business on anybody's free hosting service if that service allows scripting (like PHP) and databases. Unless, of course, you can tolerate a lot of down time (relatively speaking; a server that is up and running at peak only 95% of the time is still down or dog-slow more than 35 hours per month). You are paying nothing, thus you have no contract, and thus no SLA (service level agreement) — and you're at the mercy of all of the other users you're sharing the server with, many of whom haven't a clue what they're doing, or are trying to do naughty things, or are simply using software that really requires more resources than the Free Hosting servers have available. You get what you pay for, so if you want to make money, you really need to spend some yourself. A basic (Infinity) Premium hosting package is only $3.95/month if you pre-pay for 3 years ($142), and I'd suggest that if you can't afford to invest less than $150 dollars in your business, then you really don't have a business to invest in.
Depends what the site and business is. Don't be so arrogant lol
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
No, it doesn't depend on the type of business. (Although it may depend on the location; that may represent a significant fraction of a business's total annual income in, say, sub-Saharan Africa or in some parts of India.) In Europe and North America, it's sacrificing a month of take-out coffee or something of similar magnitude, even if you're not yet what Paul Graham calls "ramen profitable". Hell, I can afford it if I have to, and right now I'm getting by on a $500/month disability allowance. Don't mistake something you're simply not willing to do for something that isn't reasonable.
 
Messages
65
Reaction score
0
Points
6
Okay, I have two installations. Opencart and Oxwall. I placed the errors off code for Opencart and it worked. When x10hosting goes down Oxwall doesn't show errors. It shows the installation page and my public.html link. How can I not show this on oxwall file? When x10hosting server goes down where and what can I place in file manager "The sever is down and will be up shortly. Thank you for your patience."?

Thanks
 
Messages
65
Reaction score
0
Points
6
Okay, I have two installations. Opencart and Oxwall. I placed the errors off code for Opencart and it worked. When x10hosting goes down Oxwall doesn't show errors. It shows the installation page and my public.html link. How can I not show this on oxwall file? When x10hosting server goes down where and what can I place in file manager "The sever is down and will be up shortly. Thank you for your patience."?

Thanks
 
Status
Not open for further replies.
Top