How can I see the errors when running PHP?

I need to find what’s wrong either with my script or the PHP.ini settings for sending a mail but I don’t know how to see the error messages generated by the server.

I looked at PHP.ini and there are two directives to handle errors:
display_errors
log_errors

If display errors, where does it displays them. I already enabled it and I don’t see them.

If log_errors, where can I find the log archive? :shifty:

If display errors, where does it displays them.

in your browser

I already enabled it and I don’t see them.

server restart needed to changes take effect
you can check real values by running phpinfo() function in the “Local value” column
also check error_reporting directive

If log_errors, where can I find the log archive?

web-server’s error log unless other destination assigned in the error_log directive

Thank you. I’m new in all this about servers, so I appologize if I ask something that seems obvious but, how do I see the “web-server’s error log”?
(:

Don’t apologize, your questions is all right.
your web-server (Apache usually) have two log files - access log where all visitors recorded, and error log, where all errors logged.
The path to the log file is vary, depending on the server softvare and operation system

O.K. Could you give me any hint on how to find the log error file? I’m using PL Wamp on Windows.

If not, when I change display_errors to on, I can’t see the errors beacause, I think, the error happens when Submitting and it starts another page immediately. So, I think, the error message appears in the page where it occurs while I’m already in another page. Can I stay in the same page even after Submit or can I “move” the messages to the new page?

I checked error_reporting and it has All. So It doesn’t seem to be the problem.

Could you give me any hint on how to find the log error file?

open wamp directory and use search feature of windows explorer to find any file that has a word ‘error’ in it’s name

I think, the error happens when Submitting and it starts another page immediately.

It cannot be PHP error then.

By the way, what error you suspect to occur?

The PHP, can’t be because I only copy it. I think it has to do with my PHP.ini

I changed the line SMTP to:
SMTP = smtp.gmail.com

Then I changed the line sendmail_from = to:
sendmail_from = myadress@gmail.com

where “myadress@gmail.com” is the e-mail adress that I always use.

There’s a port 25 that I don’t know if I have to change. I already tried with port 567 and port 465, and nothing happens.

Everthing seems to be o.k. but when I check for my message at myadress@gmail it doesn’t appear. So, either the message is not being sent or it’s send somewhere else?

This is a quote from the link I mentioned above:

"1.In your email client software, under Outgoing mail, set the SMTP server to smtp.gmail.com.
2.Set the your username is yourgooglemailname@gmail.com and make sure “Use username and password” is checked.
3.Also check off “TLS” under “Use secure connection.”
And voila! You can send mail for any email address from any network (that lets you connect to an outside SMTP server) using your Gmail account - be sure to enter your Gmail password when prompted.

Check out Gmail’s help section on POP access for Gmail for specific instructions for setting this up with your email program. If you only want to use the SMTP server, skip the POP bits and only set up SMTP to work with your existing email account."

END OF QUOTE

I know you’re going to LOL but, what’s “my client software”

Do you need the .php script and the HTML page?

I can post them if that could help.

gmail requires authenticated smtp, php does not offer this via the mail function. You will need to use a third party library such as swiftmailer.

Well, it makes sense.
Now I suppose the error is occurred on the page that loads after you press submit button.
So, you should be able to see it, unless it commands browser to load another - the third page.
You can prevent it by putting die; command right after mail() or by commenting out all lines that contain header() function.

As for the email. you merely cannot use mail() function under windows.

And your client software must be some script, like phpmailer

Thank you AS

I’ll try it.

I read the documentation.lt says how to send a “fixed” message. Something that you writte, to several adresses.

I want the contrary. Let me show you the HTML that I copied from:
Sams Teach Yourself PHP, MySQL and Apache All in One by Julie C. Meloni:

[<html>
<head>
<title>E-Mail Form</title>
</head>
<body>
<form action=“sendmail.php” method=“POST”>
<p><strong>Name:</strong><br/>
<input type=“text” size=“25” name=“name” /></p>
<p><strong>E-Mail Adress:</strong><br />
<input type=“text” size=“25” name=“email” /></p>
<p><strong>Message:</strong><br />
<textarea name=“message” cols=“30” rows=“5”></textarea></p>
<p><input type=“submit” value=“send” /></p>
</form>
</body>
</html>

The book includes the PHP script that is supposed to send the mail. If there’s a scrpt already made, there has to be a way of implement it. In the same book it gives you the instructions to change the lines on PHP.ini:
smtp
and
mail_from
for a windows environtment. So, what’s so wrong. If I can’t use gmail, there has to be another smtp that works with these instructions, don’t you think?
Adding the library that you suggest seems to me very complicated. I mean I really appreciate the fact that you told me that it’s never going to work with gmail, but then why not another smtp?

there has to be a way of implement it

yes, there is, but you won’t like it. and it can fail too

there has to be another smtp that works with these instructions, don’t you think?

Not in this world.

Noone told you it’s never going to work with gmail.
I mentioned mail() function, which is used in your book application.

If you’re just learning, you can just leave this part alone, and move to the next

ThanK you, but if I left everything for some other time (when I know more) then I’ll never get it done.

My problems have always been related to the instalation or the selection of the software that I use rather than the programming itself. So, if I have to learn something, it is more a matter of understanding how the different parts of sofware can be integrated. What system, programm, library, smtp, WAMP, installer, etc. etc. etc. goes better with what.

Besides, I already have all the Scripts that I’m going to need (almost). I already have the Stylesheet. and the HTML forms ready to add whatever instructions that use PHP. If I can get the PHP to work, then I’ll try to integrate it with the DB. And that, of course is going to be another session of learning about configuration of the data base with all her settings and all its related rpoblems.

Programming is not an issue. Configuring the system is.

All your answers are like this. You’ve never answered one single question that I’ve made, I mean, really answer the question. I wonder why?

Your ISP occasionally lets you send unauthenticated emails via their SMTP server as you’re already on their network.

Configure the SMTP address, add your ISP email address and test. :wink:

May be you’re asking wrong questions? :slight_smile:

Programming is not an issue. Configuring the system is.

You can’t configure your wamp server to use your book email script. That’s all.
Another piece of software needed, not included in wamp - an SMTP server, complicated one.

So, you either have to find another way, or leave it alone.
Sending mail is very simple task and I’d suggest not to focus on this too much

Thak you Anthony. I’ll try it. (: