Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Error Messages


I set to php.ini this

error_reporting=E_ALL & ~E_NOTICE

to be a list of error messages and some warnings/tips on the code written.

All good, but if I have code like

------------------------
function foo(string $x)
{
echo($x);
}

foo("hi");
------------------------

I got this error

------------------------
Catchable fatal error: Argument 1 passed to foo() must be an instance of
string, string given, called in E:WorkphpphpFramework est.php on line 8
and defined in E:WorkphpphpFramework est.php on line 3
------------------------

!!!but... is not "hi" a string?
What kind of *Catchable fatal error* would be this?

:)

I write foo(string $x) exactly to say that the function need a string!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Suppressing Error Messages
Could any one please tell me a command in php to suppress error messages that come because of any reason like query invalid or any other problem .i would like to see none of the error message s to come, even if there are errors(sounds weird but i need that).

PHP 5.0 - No Error Messages Under Apache
PHP 5 beta under Apache 2 on 'doze - and get no error messages from my
PHP scripts. Whenever there's an error they simply silently stop
outputting. Running earlier versions under Linux works fine.

Version details:

Apache/2.0.47 (Win32) PHP/5.0.0b1 <-- note the beta s/w.

Is this a known problem? Is there a work-around?

Suppressing Error Messages
I keep getting an error that I don't want to show up, i have not been able to get rid of it either and i was just currious of how I might go about suppressing this error
PHP Code:

Storing Error Messages
I know how to turn off error reporting to stop php from printing the error messages but what if I also want to store the error messages into an mysql table? What's the variable that stores the error message?

Not Displaying Error Messages
Is there a simple way to prevent error messages (falsely connecting to
database etc.) being diplayed?
My own build in messages are enough...

Turn Off Error Messages
I get this error message

Warning: getimagesize() [function.getimagesize]: Read error! in /mnt/w0400/d11/s01/b02a5c57/www/familyclick.ca/messageCenter/writeMessage.php on line 95

Warning: Division by zero in /mnt/w0400/d11/s01/b02a5c57/www/familyclick.ca/messageCenter/writeMessage.php on line 102

The problem I'm having I'm having a hard time preventing the error. Is there a way to turn error messages off on certain pages.  Ideally I would like to log these errors  any idea how to do this.

No Error Messages In Mamp
Im trying to use the mamp set up on a mac. For some reason error messages dont display in the browser which make development quite difficult. Does anyone know how to turn error messages on?

How To Suppress Error Messages Without Using Error_reporting(0) ?
This line:

if (file_exists($fileName)) {

is (on some web servers) giving me this kind of error:

Warning: SAFE MODE Restriction in effect. The script whose uid is 1022
is not allowed to access /home/www owned by uid 0 in
/home/www/krubner/ppKernel/McControllerForAll.php on line 454

This only happens when the software is checking directories that are
above what where PHP is allowed to check.

I want this software to work on all servers and I don't want the end
user to have to know PHP, and so I don't want them to have to set
error_reporting() on their own. I also feel like I shouldn't have to
do this:

error_reporting(0);

because my software should capture all errors on its own and store all
the error messages that I write in the resultsObject that my software
uses. Turning off error reporting is cheating, in my view, the
programmer should capture all errors on their own.

So how do I suppress errors on a line like this?

if (file_exists($fileName)) {

PHP Error Messages As String In A Variable
Can I put all errors which PHP outputs when error_reporting(E_ALL); is
activated into a variable? I want to react if an error occurs.
I'm working on a Script to check if an ftp is running or not. The only way
to get the error message of the ftp when the connection fails is if
error_reporting(E_WARNING); or error_reporting(E_ALL); is activated. I want
to format the Error Message. E.g. The errormessage is:
Warning: ftp_login() [function.ftp-login]: Sorry, Over 2 connection not
allow in c:inetpubwwwrootscriptsvbb_ftp.php on line 13.

I only want this output: "Status: Sorry, Over 2 connection not allow "

Apache2Triad PHP Errors Without Error Messages
How do I get Apache2Triad to print the reason it stops while executing
my PHP
programs?

Apache/PHP Not Giving Me Error Messages
I have just recently installed Apache2 and PHP5 on my computer.
Normally when I make a syntax mistake on my webspace it gives me an
error message on the .php page when i load it and the line the error is
on. When i load a page on my own computer through http://localhost it
just stops outputing the code on the page where the error is and leaves
the rest blank.

Do i need to configure Apache or PHP to display errors? If so, how?

Mail(): Error Messages NOT Back To Wwwrun?
a friend was so kind to host my php scripts. but when they use mail()
or phpmailer (or whatever) to email e.g. to an invalid address, the
returning error message appears in *my friend's email inbox*
(recipient - or sender? - is "wwwrun" of my friend's machine). I
guess you understand which problem I mean. To fix the problem, I would
like to understand what is going on here - in the mail header, i did
set replyto, x-sender and from to *my* email address, but it doesnt
help. so where must I change what to free my kind friend from this
"spam"?

Open_basedir Is Commneted Out In My Php.ini File, Yet I Still Get The Error Messages
If I ssh to my server and look at the php.ini file, it apears that
open_basedir is off:

Interpreting Error Messages From Include Files...
lets say i have the following files:

1. error.php: that is routed to for all errors. this page should
display proper and explanatory error messages to the user based on the
parameter provided.
2. errordef.php: has all the error codes and their explanations
"defined" as constants.

now, say if i have 3 different files viz. a.php, b.php and c.php, and
when any error occuring in either these files, i want to route to
error.php for detailed explanation. each a.php, b.php and c.php passes
error code to error.php, but error.php should interpret the code from
the definition file errordef.php!

Putting Form Error Messages Into A List
I have some form validation and I want to put all the error messages that are displayed into a bulleted list. I have seen it done with more complicated validation using OOP but I don't know enough to do that. How would I add these error messages to a list if they occur? Code:

Links Pointing On PHP Manual Not Shown In Error Messages
I have html_errors set On and it's visible that it's on because I get some parts
of the error messages bold. The problem is I can't get any links to point to the
PHP manual.
docref_root = "/php_manual/"
docref_ext = ".html"
are set but no links are appearing. By that I mean there are absolutely no <a>
tags or anything of that sort in my error outputs. I tried generating almost
every type of error but please if somebody could post a line or two of code that
produces some clickable error message on their box so that I can test it on my.
(send the output also, please)

if my script is:
<?php
$var1 = 'var1'
$var2 = 'var2'
?>
I get this output
<br />
<b>Parse error</b>: syntax error, unexpected T_VARIABLE in
<b>e:www estarray.php</b> on line <b>3</b><br />

shouldn't there be any links in that pointing to PHP manual in my php_manual
dir? :-(

Strange Apache Error Log Messages When Viewing PHP Scripts
Whenever I would view any of my PHP scripts on any of a number of
servers that I run, the Apache error logs on each of them would have
this rather strange error:

[Tue Mar 28 13:01:33 2006] [error] [client *.*.*.*] File does not
exist: C:/Program Files/Apache Group/Apache2/htdocs/tools/myapp/tools,
referer: http://www.myappworld.com/tools/myapp

It never generates any PHP-related errors, warnings, notices, anything
related to this of any kind; furthermore, all of my apps on all of my
servers run with no problems whatsoever, however, multiple instances of
this very same error message occurs at each page that I visit.

there is no such file nor directory, of course, as
"../htdocs/tools/myapp/tools", however, there is "/htdocs/tools/myapp".

"Cannot Find Module" Error Messages In PHP
Red Hat Enterprise Linux 4.X.

I'm writing command-line PHP scripts for the first time.

I get the messages below. What do they mean? Are these operating system
library modules, or something in PHP that I don't have? Do I need to
install more Linux packages? Or adjust PHP in some way?

[dashley@pamc standalone]$ ./sitehashkeygen.php
No log handling enabled - turning on stderr logging
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (LM-SENSORS-MIB): At line 0 in (none)
Cannot find module (IPV6-ICMP-MIB): At line 0 in (none)
Cannot find module (IPV6-MIB): At line 0 in (none)
Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
Content-type: text/html
X-Powered-By: PHP/4.3.9

Die Messages..
Is there a way to change die to either a pop up error so that when the user clicks ok it'll close the pop up and then they can correct what needs to be done. I have this done for validation stuff using javascript but not for when there is a php or mysql issue involved as i was unsure it could be done?

Or is there a way to change die to a location method without loosing the player's inputted data when they go back to the page to correct their mistake?

Reason why is i'm trying to eliminate the die's where by it goes to a new page just to display "your password incorrect", its mainly to keep it a bit more professional looking.. which is the best way in your opinion ?

Sending MSN/ICQ Messages
Does anybody know if it's possible to send MSN/ICQ messages with PHP to registered MSN/ICQ users?

Getting Contradictory Messages.
I know little to nothing about PHP and need to clarify something before
committing to learning it.

From what I have heard PHP would be ideal to interrogate a database and
populate HTML tables with found data (text AND URL's).

However, what I want to do is to have the files on a CD rather than a web
site.

One colleague assures me that having PHP run on my machine is not a problem.
Another says absolutely not, PHP is server based.

So, my question is can PHP be run locally to access data and web pages on a
CD? And a follow up is, can PHP (also?) be installed ON the CD and be able
to run on any PC that had a compatible browser?

Messages Being Sent In Emails
I'd like to have the users of a web site to be able to send a note to a friend to tell them about the site. As such, I paint a screen with a canned message and they fill in the email of the friend and submit the page. the stripped down code looks something like this (minus some validations): PHP Code:

Sending Aim Messages With Php
I am using slackware 9.1 with php 4.3.6 and I am trying to get the
testscript included with phptoclib to work.

Here is the output I get:
meshap@the45:~/public_html/toc$ php -q testscript.php
php: error while loading shared libraries: libmm.so.13: cannot open
shared object file: No such file or directory

What is libmm.so.13 and where do I get it?



PHP & SQL - Outputting Messages
Ive managed to connect my sql database using php but the problem im coming across is outputing a message if something equals to null, i.e. i have an attribute in the database called 'Imagename1' so what i want to do is print out a message saying 'no image exist' Code:

50 Messages Array
I have to create a form that a single user fills in and clicks Post. When Post is clicked, it will add all the information entered in 4 arrays then creates a table at the bottom of the page. Now I got the table to create, but the problem is, everytime I click "Post", it keeps overwriting the same array key therefore overwriting the same table. Code:

Slashes In Messages
when i type a form and sent it in php text like:

The site hasn't
gets displayed as:

The site hasn't
i know this does line breaks

$message = nl2br($_POST['message']);
but is it add or stripslashes for my problem above?

HTML In Email Messages
Got a problem, when i post a message with tje mail() option in php i get the following error from my site i use the content 8895-1 ISO.....

How To Suppress Warning Messages
I do not want any warning messages to appear in my application. How can I suppress the output of warnings?

Sending Multy Messages
I am trying to send mulity messages to my members, I can send them to each member but not to a group. The php reads the id from the database but I want it to read the trade id so that I can send it to all web designers for example. See code:

Messages Dynamic Always On The Page?
I wanna show a table displaying messages on-line. Example one user post a message " Hello World I am Edwin Quijada" and inmediately this messages will begin to be display into a section in the page . Of course this messages will be saved into table and after validate will be display. Is there a way to refresh the page always the table be modified??

Sending SMS/SMS PUSH Messages
Does anyone know any free services that can be used to send sms to US and Canada for free? I would like to write s cript in php to use those services and send SMS messages to cell phones.

I also would like to send such an sms message to phone that has hyperlink in it. If I am not mistaken, this is called wap push SMS message.

How To Save Messages From Forum?
I started to write web based forum and understood that I have
conceptual problems. I do not know how I should save messages of users.
As parts of one file, as different files, or may be in database?

Email Messages With Odd Breaks
I'm creating a PHP form handler that will send an email to a user
based on form entries (a rather standard procedure). I've never had
any problems with this type of programming challenge before; however,
this is a very complex form. I save all of the form's data in a single
variable named $mailout and then call the mail() function with
$mailout as the body.

The information I'm sending is about 1200 characters long. I noticed
that in the email the user receives, there is an odd break at about
character 1000. It reads something like this:

Style: Red tu!
dor with attached garage

Everything else looks correct. The first 1000 characters are right and
any remaining characters are right. It's just at about character 1000
I get an exclamation point and then the data continue on the next line
(with a small indent).

I thought that maybe there was some sort of limit to the size of the
PHP variable, so I broke $mailout into two pieces, both well under the
magic size limit. That did not help.

I thought that maybe the mail() function was somehow breaking up this
message, so I created a small routine to write the output directly to
sendmail. That didn't help.

I wonder if this is a sendmail issue. Does anyone know of any reason
why I'm getting this odd break in my messages and how I can fix it?

Hotmail Num-of-new-messages Query
I'm racking my brain trying to scrape the number of new emails I have
on hotmail.
I'm reading and passing cookies and following urls like crazy, but I
just keep going in a circle... I'm obviously missing something or
doing something wrong...

Does anyone have any code for this using cURL or just plain 'ol
fsockopen?

Redirecting Echo Messages
I know why Headers Already Sent errors occur and I have put my processing at the top of the page to avoid this. However, the processing includes echo messages that will show if certain fields are not filled in or incorrect like this: Code:

Cascading Object Messages
Is there anyway to do something like this:

$foo->bar()->baz()

....where $foo->bar() presumably returns an object that implements baz? I
keep getting an error when doing this type of construction.

Passing Object Messages Back And Forth
I have two classes I want to talk to each other:

1. user class = registers a user

2. validation class = verify data

for example lets say I'm doing a sign up form, user enters in a username and I want to check that user name and if its good - let them register

in the user class I want to set the username from the form and verify its in the right format using the validator class.

Here comes my question....

When using methods of other objects do I need to do a $object = NEW class ? or can I just include that class file and call its methods?

Actually I wanna know what the best way is (most proper for OO)

Right now if I have a class that uses another class I do a NEW in the constructor.

Log Into A POP3 Mailbox And Delete The Messages.
I am trying to make a simple web tool that will log into a POP3 mailbox and
delete the messages all at once. I have came up with this and if the Login
information is correct it does delete the mail,but if the login info is
incorrect you do not know until after you try to login to the mailbox again
via telnet or anything like that and notice that the mail is still there.
Does anyone have any idea how I could make this script so it will tell us
that the information is incorrect? Any help would be appreciated.

<?
$host = $_POST['address'];
$user = $_POST['username'];
$pass = $_POST['password'];

################################################## #####################
# End Configuration #
################################################## #####################
#Until I rewrite my scripts, this will suffice for bg-compatibility;
if(phpversion() >= "4.2.0"){
extract($_POST);
extract($_SERVER);
extract($_ENV);
}
#Format output for console or for web?
$nl = ((isset($REMOTE_ADDR)) ? "<br>" : "");

if(!$sock=fsockopen($host, 110, $err, $errno, 10))
die("Couldn't connect to the POP server$nl");

fputs($sock, "USER $user");
$buf = fgets($sock, 1024);
if($buf[0] != '+')
die("POP server didn't like USER $user$nl");
fputs($sock, "PASS $pass
");
$buf = fgets($sock, 1024);
if($buf[0] != '+')
die("POP server didn't like PASS$nl");

fputs($sock, "STAT");
$buf = fgets($sock, 1024);
fputs($sock, "STAT");
$buf2 = fgets($sock, 1024);
list($stat, $num, $size) = split(' ', $buf2, 3);
echo "Mailbox has $num messages$nl";

for($i=1; $i<=$num; $i++){
$command = "DELE $i";
echo "Deleting message $i with DELE $i$nl";
fputs($sock, $command);
$buf = fgets($sock, 1024);
if($buf[0] != '+')
die("POP server didn't like DELE $i: ($buf)$nl");
}
fputs($sock, "QUIT");
$buf = fgets($sock, 1024);
fclose($sock);
?>

How To Get PHP To Remove Html Code From Messages
I am running php scripts from the command line, and it always outputs
errors in html mode. Is there an option to disable the html from the
error messages?

Restrict Number Of Messages/page
i've wrote a code who simply does write text in a simple text file. how can i restrict the messages on the site by using index.php?page=<any-number>? i've seen it on a lot of sites, among this very one that you are viewing right now. if not clear yet, i want a "next"-button to restict so only, lets say, 5 messages are shown/page

I Keep Getting Backslahes In Messages Using Online Forms.
When filling in a form to contact peole for my site, and they send it, at the email address that it's sent I get a lot of 's throughout the email, apparently the php form processing coding includes that in there for some reason. Anyone know how to remedy this.

Double Spaces In Mail Messages
When I send a message using the mail command in PHP some e-mail
addresses somehow put two returns in place of one return, so this:

$message = "Test
Test2"

becomes

Test

Test2

But if I mail this:

$message = "Test
Test2"

it works the same for all e-mail addresses. Why is it doing this? I use
Red Hat Linux and Apache.

Warning: Fsockopen() (how To Disable Debug Messages)
In Win32 PHP you can disable debug messages using the php.ini Can someone tell me how to do that in linux? there is no php.ini in linux Php script running on windows Php script running on linux.

How To Capture Error_reporting Messages To A Text File
I was wondering if there was a way to capture the errors reported by: PHP Code:

Unread Messages In Inbox Of Email Account ?
Is there a way of determining how many unread messages there in an email inbox using php?

Phpmailer.class Messages Are Been Converted To Plain Text...
I am using a phpmailer class to send some staff over the email...

I am tring to send it with text/html but for some reason the email are
been converted to plain and all the headers are shown, here is the
email...

X-Tour4Less.co.il Mailer:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_27976937fb6a931b3ed2d40aebd76a26"

--b1_27976937fb6a931b3ed2d40aebd76a26
Content-Type: text/plain; charset = "windows-1255"
Content-Transfer-Encoding: 8bit

×*יסיון עברית

--b1_27976937fb6a931b3ed2d40aebd76a26
Content-Type: text/html; charset = "windows-1255"
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<html>
<head>

<META HTTP-EQUIV="Content-Type" content="text/html;
charset=windows-1255"</head<body<p dir=RTL><span
lang=HE>&#1513;&#1500;&#1493;&#1501;&nbsp;&#1495;&#1489;&#1512;&#1514;
Tour4less contact .</span></p<p dir=RTL><span
lang=HE>&#1502;&#1513;&#1514;&#1502;&#1513; &#1513;&#1500;
&#1492;&#1488;&#1514;&#1512; &#1513;&#1500;&#1504;&#1493; </span><span
dir=LTR>TOUR4LESS.CO.IL</span><span dir=RTL></span><span lang=HE><span
dir=RTL></span&#1492;&#1514;&#1506;&#1504;&#1497;&#1497;&#1503;
&#1489;&#1497;&#1510;&#1497;&#1512;&#1514; &#1511;&#1513;&#1512;
&#1488;&#1497;&#1514;&#1493; &#1506;&quot;&#1497;.........

Warning Messages When Script Executed From Command Line
PHP INI File Setting
------------------------------------------------------------------------------------------------------------------
error_reporting = E_ALL & ~E_NOTICE

No warning message are displayed when script executed from the browser.
Only Error, Fatal errors are displayed.

But when the same script is executed from the command line
192.168.0.2# php lpmonitor.php
Warning messages are displayed.

PHP Warning: Module 'ctype' already loaded in Unknown on line 0
PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'iconv' already loaded in Unknown on line 0
PHP Warning: Module 'pspell' already loaded in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/20041030-debug/ssh2.so' -
/usr/local/lib/php/20041030-debug/ssh2.so: unsupported file layout in
Unknown on line 0
PHP Warning: Module 'pcre' already loaded in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
bash: fstat: command not found

What are all these errors and how can I suppress these errors from
being displayed in command line also.

Parsing Incoming "bad Email" Messages
I have a database mailing list and when I send to them, I get a whole bunch of errors for bad emails - either people who've changed emails or typed in a bad address (it's not spam, it's a subscription service). I was wondering how I'd go about using PHP to process all the incoming "bad email address" emails and extract the bad emails out of them, then remove them from the database.

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?


Copyright © 2005-08 www.BigResource.com, All rights reserved