php-general Digest 7 Aug 2011 18:15:20 -0000 Issue 7433
Topics (messages 314399 through 314414):
Re: Intentionally generate an "Internal Server Error"
314399 by: shiplu
314400 by: Ghodmode
314401 by: shiplu
314402 by: shiplu
314403 by: Ghodmode
314404 by: Tamara Temple
314405 by: Ashley Sheridan
314407 by: Paul Scott
Re: Unanticipated characters returned from multidimensional array
314406 by: David Green
problem installing CakePHP on Linux
314408 by: Negin Nickparsa
314409 by: Peet Grobler
314410 by: Negin Nickparsa
314411 by: Negin Nickparsa
314412 by: Negin Nickparsa
314413 by: Negin Nickparsa
Login with Remember me Feature
314414 by: alekto
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Sun, Aug 7, 2011 at 9:50 AM, Ghodmode <[email protected]> wrote:
> I'd like to use PHP to intentionally generate an "Error 500 Internal
> Server Error".
>
> Here's the problem. My site has this error intermittently and I'd
> like to monitor the error log to figure out the problem.
> Unfortunately, I don't get to see the actual Apache error log and my
> hosting provider's error reporting system isn't working. Customer
> support just sends me canned responses stating that everything's fine
> and they can't reproduce the error, so I'd like to create a
> reproducible internal server error so that they can see that it's not
> showing up in the error log.
>
> I know that I can mess up something in the .htaccess file, but that
> would break the whole site. I don't want to do that.
>
> I know I could use header("HTTP/1.1 500 Internal Server Error"), but
> that means I would also have to provide the content of the Error 500
> page. I want to kick off they're internal server error page. They
> don't give me to option to create one of my own.
>
> I'm using GoDaddy.
>
> Can someone suggest some invalid PHP code that should generate an
> internal server error?
>
> Thank you.
>
> One way would be, write a php extension and perform segfaults there.
--
Shiplu Mokadd.im
Follow me, http://twitter.com/shiplu
Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---
On Sun, Aug 7, 2011 at 12:05 PM, shiplu <[email protected]> wrote:
> One way would be, write a php extension and perform segfaults there.
>
Unfortunately, I don't know how to write an extension or intentionally
perform a segmentation fault.
If I did know how to intentionally perform a segmentation fault, wouldn't
that be enough to generate a 500 error in a single php file without needing
to be in an extension?
--
> Shiplu Mokadd.im
> Follow me, http://twitter.com/shiplu
> Innovation distinguishes between follower and leader
>
Thank you.
--
Ghodmode
http://www.ghodmode.com/blog
--- End Message ---
--- Begin Message ---
You can search for a buggy extension that has known issue of segmentation
faults.
--
Shiplu Mokadd.im
Follow me, http://twitter.com/shiplu
Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---
By the way, You can also try sending proper html page and http header that
will copy the Internal Server Error.
That is completely possible in php.
Just use the header() function.
--
Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---
On Sun, Aug 7, 2011 at 12:38 PM, shiplu <[email protected]> wrote:
> By the way, You can also try sending proper html page and http header that
> will copy the Internal Server Error.
> That is completely possible in php.
> Just use the header() function.
>
Actually, I learned from reading a previous message on this list (Subject:
"php causes HTTP 500, but results in blank page in apache"), that using
header() would require me to provide the content of the error page.
That probably should still put a message in the error log, but it wouldn't
be enough to convince the stupid tech support people at GoDaddy that it was
an error.
I want them to see their own error page and then fix the problem with the
logging.
--
> Shiplu Mokadd.im
> My talks, http://talk.cmyweb.net
>
> Follow me, http://twitter.com/shiplu
> Innovation distinguishes between follower and leader
>
--
Ghodmode
http://www.ghodmode.com/blog
--- End Message ---
--- Begin Message ---
On Aug 6, 2011, at 10:50 PM, Ghodmode wrote:
I'd like to use PHP to intentionally generate an "Error 500 Internal
Server Error".
Here's the problem. My site has this error intermittently and I'd
like to monitor the error log to figure out the problem.
Unfortunately, I don't get to see the actual Apache error log and my
hosting provider's error reporting system isn't working. Customer
support just sends me canned responses stating that everything's fine
and they can't reproduce the error, so I'd like to create a
reproducible internal server error so that they can see that it's not
showing up in the error log.
I know that I can mess up something in the .htaccess file, but that
would break the whole site. I don't want to do that.
I know I could use header("HTTP/1.1 500 Internal Server Error"), but
that means I would also have to provide the content of the Error 500
page. I want to kick off they're internal server error page. They
don't give me to option to create one of my own.
I'm using GoDaddy.
Can someone suggest some invalid PHP code that should generate an
internal server error?
Thank you.
I don't think it's that hard to generate an Internal Server Error. If
you have error reporting and such turned off and your code contains a
syntax error, that results in an Internal Server Error...
--- End Message ---
--- Begin Message ---
Tamara Temple <[email protected]> wrote:
>
>On Aug 6, 2011, at 10:50 PM, Ghodmode wrote:
>
>> I'd like to use PHP to intentionally generate an "Error 500 Internal
>> Server Error".
>>
>> Here's the problem. My site has this error intermittently and I'd
>> like to monitor the error log to figure out the problem.
>> Unfortunately, I don't get to see the actual Apache error log and my
>> hosting provider's error reporting system isn't working. Customer
>> support just sends me canned responses stating that everything's fine
>> and they can't reproduce the error, so I'd like to create a
>> reproducible internal server error so that they can see that it's not
>> showing up in the error log.
>>
>> I know that I can mess up something in the .htaccess file, but that
>> would break the whole site. I don't want to do that.
>>
>> I know I could use header("HTTP/1.1 500 Internal Server Error"), but
>> that means I would also have to provide the content of the Error 500
>> page. I want to kick off they're internal server error page. They
>> don't give me to option to create one of my own.
>>
>> I'm using GoDaddy.
>>
>> Can someone suggest some invalid PHP code that should generate an
>> internal server error?
>>
>> Thank you.
>
>I don't think it's that hard to generate an Internal Server Error. If
>you have error reporting and such turned off and your code contains a
>syntax error, that results in an Internal Server Error...
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
Quickest way I know of is to mess up an .htaccess file!
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--- End Message ---
--- Begin Message ---
On Sun, 2011-08-07 at 07:30 +0100, Ashley Sheridan wrote:
> Quickest way I know of is to mess up an .htaccess file!
Another good way to do it on shared hosts is to give a file incorrect
permissions and try and access it
--
-- Paul
http://www.paulscott.za.net
http://twitter.com/paulscott56
http://www.chisimba.com
signature.asc
Description: This is a digitally signed message part
--- End Message ---
--- Begin Message ---
On Sat, Aug 6, 2011 at 4:44 PM, Shawn McKenzie <[email protected]> wrote:
>
> I haven't look through it long enough to find out about the characters,
> but try this:
>
> foreach($tableNews as $headline => $text){
> echo "<br>";
> echo $text['text'];
> echo "<pre>";
> echo $text['user']['name'];
> echo "</pre>";
> }
>
>
That does it perfectly, thank you. It seems very likely that the unwanted
characters were coming out of my jumbled logic somewhere..
Regards
David
--- End Message ---
--- Begin Message ---
Hello List
I want to use Cake PHP ,I have downloaded it from it's site,rename the
folder to first_app
and copied it to
/srv/www/htdocs
my root is here:
/srv/www/htdocs
by entering http://localhost/first_app/
it has some errors like these outputs:
Warning: _cake_core_ cache was unable to write 'default_en-us' to cache in
/srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
_cake_core_ cache was unable to write 'default_en-us' to cache in
/srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
/srv/www/htdocs/first_app/app/tmp/cache/persistent/ is not writable in
/srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299 Warning:
/srv/www/htdocs/first_app/app/tmp/cache/models/ is not writable in
/srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299
I wanted to identify another root in default-server I used this one:
<Directory "/srv/www/htdocs/first_app/app/webroot">
AllowOverride All
Options FollowSymLinks
# Order deny,allow
# Deny from all
</Directory>
I restarted the apache but again the same warnings
then I changed httpd.conf too.
I tried hard to figure it out.
if it is about the permissions I tried this one:
chmod -R 0755 /srv/www/htdocs/first_app/
would you please tell me how to change the root correctly?
or if it is not related to it What is the problem?
Thanks in Advance.
--- End Message ---
--- Begin Message ---
On 8/7/2011 9:53 AM, Negin Nickparsa wrote:
> Hello List
>
> I want to use Cake PHP ,I have downloaded it from it's site,rename the
> folder to first_app
> and copied it to
> /srv/www/htdocs
>
> my root is here:
>
> /srv/www/htdocs
>
> by entering http://localhost/first_app/
>
> it has some errors like these outputs:
>
> Warning: _cake_core_ cache was unable to write 'default_en-us' to cache in
> /srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
> _cake_core_ cache was unable to write 'default_en-us' to cache in
> /srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
> /srv/www/htdocs/first_app/app/tmp/cache/persistent/ is not writable in
> /srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299 Warning:
> /srv/www/htdocs/first_app/app/tmp/cache/models/ is not writable in
> /srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299
Try
$ chown -R www-data:www-data /srv/www/htdocs/first_app
Replace www-data:www-data with what is appropriate on your system.
--- End Message ---
--- Begin Message ---
Thank you, I found that only the tmp directory must be writable then I used
this one:
also by right clicking and using wwwrun for user I tried to set them as you
told
chmod -R 0777 /srv/www/htdocs/first_app/app/tmp/
and the I get fatal Error:
<http://cakephp.org/changelogs/1.3.6> Fatal error: Class 'Debugger' not
found in /srv/www/htdocs/first_app/cake/libs/view/pages/home.ctp on line 26
--- End Message ---
--- Begin Message ---
I have debugger.php in cake/libs I don't know why it doesn't access to this
file and tell me can't find the class
--- End Message ---
--- Begin Message ---
cool I found this hidden file .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
well I don't know that this apache module is enabled or not I changed the
apache2 in /etc/sysconfig and add the rewrite in modules right here:
APACHE_MODULES="actions alias auth_basic authn_file authz_host
authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env
expires include log_config mime negotiation setenvif ssl suexec userdir php5
rewrite"
--- End Message ---
--- Begin Message ---
Finally I solved my problem!
I have downloaded another version of cake that is less than 2 now it works
like a charm:)
--- End Message ---
--- Begin Message ---
Hi,
I have implemented a "remember" me feature in my login-script, but I can't get
it to function!
I want to make it possible for the users to stay logged in for 30 days.
This is what I got this far:
This checkbox is placed Inside the index.php script, near by the
username/password field.
<p><input type="checkbox" name="remember">Remember me</p>
This is all I have added in the index/login script that has something to do
with the remember me feature.
When it comes to saving the username/password to cookies, I have added three
parts to the connextion.php script, all highlighted.
Obviously, I have not found out why this feature does not work, but I might
have placed the different if-loops in the wrong places, or it could be that the
if-codes are not correct themselves?
Anyways, all help are appreciated.
Cheers!
connextion.php:
<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/>
<link href="<?php echo $design; ?>/style.css" rel="stylesheet"
title="Style" />
<title>Connexion</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="<?php echo $design;
?>/images/logo.png" alt="Members Area" /></a>
</div>
<?php
//1. unset the cookies if the user logs out.
if (isset($_COOKIE['cookname']) && isset($_COOKIE['cookpass']))
{
setcookie("cookname", "", time()-2592000, "/");
setcookie("cookpass", "", time()-2592000, "/");
}
//If the user is logged, we log him out
if(isset($_SESSION['username']))
{
//We log him out by deleting the username and userid sessions
unset($_SESSION['username'], $_SESSION['userid']);
?>
<div class="message">You have successfuly been loged out.<br />
<a href="<?php echo $url_home; ?>">Home</a></div>
<?php
}
else
{
$ousername = '';
//We check if the form has been sent
if(isset($_POST['username'], $_POST['password']))
{
//We remove slashes depending on the configuration
if(get_magic_quotes_gpc())
{
$ousername = stripslashes($_POST['username']);
$username =
mysql_real_escape_string(stripslashes($_POST['username']));
$password = stripslashes($_POST['password']);
}
else
{
$username =
mysql_real_escape_string($_POST['username']);
$password = $_POST['password'];
}
//We get the password of the user
$req = mysql_query('select password,id,usr_level from users
where username="'.$username.'"');
$dn = mysql_fetch_array($req);
//Get user level of the user
$usr_level = $dn['usr_level'];
//We compare the submited password and the real one, and we
check if the user exists
if($dn['password']==$password and mysql_num_rows($req)>0)
{
//If the password is good, we dont show the form
$form = false;
//We save the user name in the session username and the
user Id in the session userid
$_SESSION['username'] = $_POST['username'];
$_SESSION['userid'] = $dn['id'];
$_SESSION['usr_level'] = $dn['usr_level'];
if($usr_level == admin)
{
?>
<div class="message">You have successfuly been logged in. You can now access
the admin area.<br />
<?php header("Location: index_admin.php"); ?></div>
<?php
}
if($usr_level == newbie)
{
?>
<div class="message">You have successfuly been logged in. You can now access to
the newbe area.<br />
<?php header("Location: index_newbe.php"); ?></div>
<?php
}
if($usr_level == advanced)
{
?>
<div class="message">You have successfuly been logged in. You can now access
the advanced area.<br />
<?php header("Location: index_advanced.php"); ?></div>
<?php
}
//2. checks if the Remember me check box is checked or not
if (isset($_POST['remember'])){
setcookie("cookname", $_SESSION['username'],
time()+2592000, "/");
setcookie("cookpass", $_SESSION['password'],
time()+2592000, "/");
}
//3. checks the users cookies for the username and password
if (isset($_COOKIE['cookname']) &&
isset($_COOKIE['cookpass'])){
$_SESSION['username'] = $_COOKIE['cookname'];
$_SESSION['password'] = $_COOKIE['cookpass'];
}
}
else
{
//Otherwise, we say the password is incorrect.
$form = true;
$message = 'The username or password is incorrect.';
}
}
else
{
$form = true;
}
if($form)
{
//We display a message if necessary
if(isset($message))
{
echo '<div class="message">'.$message.'</div>';
}
//We display the form
?>
<div class="content">
<form action="connexion.php" method="post">
Please type your IDs to log in:<br />
<div class="center">
<label for="username">Username</label><input type="text"
name="username" id="username" value="<?php echo htmlentities($ousername,
ENT_QUOTES, 'UTF-8'); ?>" /><br />
<label for="password">Password</label><input type="password"
name="password" id="password" /><br />
<input type="submit" value="Log in" />
</div>
</form>
</div>
<?php
}
}
?>
</body>
</html>
--- End Message ---