GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   a question for php gurus (https://gfy.com/showthread.php?t=225445)

latinasojourn 01-24-2004 08:18 PM

a question for php gurus
 
ok, so i needed to make a few very important pages in "php" on a few websites.

then something happens on the server, maybe mySQL can't connect or the mySQL datatbase gets corrupted somehow.

and then this very important web page does not load.


is there a general setting in php that makes it tolerant of failure?


what i'm asking is---is there a way to configure it on the server so the php page will always load no matter what happens.


any advice appreciated!

- Jesus Christ - 01-24-2004 08:20 PM

wtf.


If my computer breaks can you make it still work with some setting?


:1orglaugh

Xdream 01-24-2004 08:22 PM

Always back up!! back up!! back up!! Before :)

Permissions?

latinasojourn 01-24-2004 08:24 PM

for example, if there is a problem with hahahahahahahahahaha, a page can still function---the hahahahahahahahahaha may be wrong, but the page will load, it will say "done, error on page" etc in task bar.

sometimes when php fails the page won't load at all.

that's what i'm trying to avoid.

i'll bet someone here knows the answer for this.

latinasojourn 01-24-2004 08:27 PM

certainly, i have a backup.


the issue is, the pages involved are key pages in a website tour which need php for some trick autoupdating.

and if something fails (like a failure at my host with their mySQL server) the darn page won't load.

Rorschach 01-24-2004 08:35 PM

It depends on the functions you're using, you can suppress error output but some functions will end the script if they fail, others will just return the error message and try to continue.

latinasojourn 01-24-2004 08:38 PM

Quote:

Originally posted by Rorschach
It depends on the functions you're using, you can suppress error output but some functions will end the script if they fail, others will just return the error message and try to continue.

ok Rorschach, i knew there were some smart guys here :)


is there a "general" setting that you would change to build in "fault tolerance"?

Rorschach 01-24-2004 08:50 PM

I'm no PHP guru but I don't think so, AFAIK it's more an issue of each individual function. For example, IIRC, include() will return an error if it fails and try to continue, whereas require() will end the execution of the script if it fails. There are options in php.ini that you can use to determine the level of error reporting, and you can use @ in front of function names to suppress errors, but there's nothing that's going to change the way a function fundamentally works short of rewriting it.

One way to get around fatal errors is to use if/else statements - eg in psuedo code

if(function())
{
do this;
}
else
{
print error;
}

Maybe someone else can shed more light on an answer.

latinasojourn 01-24-2004 09:07 PM

Quote:

Originally posted by Rorschach
I'm no PHP guru but I don't think so, AFAIK it's more an issue of each individual function. For example, IIRC, include() will return an error if it fails and try to continue, whereas require() will end the execution of the script if it fails. There are options in php.ini that you can use to determine the level of error reporting, and you can use @ in front of function names to suppress errors, but there's nothing that's going to change the way a function fundamentally works short of rewriting it.

One way to get around fatal errors is to use if/else statements - eg in psuedo code

if(function())
{
do this;
}
else
{
print error;
}

Maybe someone else can shed more light on an answer.


Rorschach, i appreciate your thoughts on this.

but i don't want to re-write the script i'm using. it a commerically avail script (autolinkspro) that i'm using to automatically update (every 15 minutes in this case) certain images on a tour which contain a link to a sample video.

the reason i use this instead of a random js is because it prevents the surfer from just refreshing the page and downloading the next video sample---it's a bandwidth saver.

the problem here is that this is a key page in the tour. a couple times in the last month something has happened at my host (got errors of "can't connect to mySQL server") which caused this important page to not load---which then completely destroys the tour.

and these sorts of things always seem to happen at 3am and you don't notice something is wrong until you look at your sales figures and wonder why you aren't getting signups on the domain, and then you go check it and the darn page is loading.

so i'm looking for a way to tweak the general php settings on the server, so if php has problems, at least the page will still load even if the php parts of the page won't load.

mrthumbs 01-24-2004 09:11 PM

really simple

just end every mysql query with the mysql_error() routine
and instruct your script to kill everything or redirect to another page in case of an error..


http://php.net/mysql_eror

Mr. T 01-24-2004 09:17 PM

Also, by pre-pending the "@" symbol to php specific functions it will supress errors...such as @include or @mysql_connect(...)

Just my two cents...

-Mr. T

latinasojourn 01-24-2004 09:21 PM

gentleman, thank you all.

but, would it not be simpler to just alter the general php settings on the server? (as opposed to altering the script)

for example, just take a look at "mydomain.com/phpinfo.php" and make a change to the general php config to build in some fault tolerance.

i cannot solve the problem this way?

Rorschach 01-24-2004 09:29 PM

If you want a really easy solution, put all your images into a directory named by date, and call the image names dynamically according to what day it is.

latinasojourn 01-24-2004 09:42 PM

Quote:

Originally posted by Rorschach
If you want a really easy solution, put all your images into a directory named by date, and call the image names dynamically according to what day it is.

well that sounds good, but what i'm doing is more complicated.

this autolinks script does some neat things, it allows me to show a dynamically changed image, with it's unique description, which links to a unique html sales page, which links to a unique "sample video" every 15 minutes.

this is the house of cards i'm trying to keep from falling, and it only falls apart when there is a php error.


All times are GMT -7. The time now is 01:13 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123