Jump to content
php.lv forumi

undefined funkcion mail()


Recommended Posts

Met erroru:

Call to undefined function mail()

php.ini:

 

[mail function]
; For Win32 only.
SMTP = mail.mansdomens.lv
smtp_port = 25

; For Win32 only.
;sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

[SQL]

caur putty norestartēju serveri, bet tāpat neiet...

Apache2 Linux

Link to comment
Share on other sites

Pārkompilēt... takš lasi RTFM

 

Requirements

 

For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them. PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary.

Edited by Delfins
Link to comment
Share on other sites

Tikpat labi var būt, ka nav iestartēts pats sendmail (ir man tā gadījies ;-) ). Caur to pašu putty izpildam komandu

ps aux | grep sendmail
Ja nav rezultāta, tad ir skaidrs, ka sendmail daemon`s negriežas. Tālāk meklējam kā tavam distributīvam piedabūt šamo startēties automātiski. FreeBSD (pēdējā laikā vienīgas NIX pie kura man sanāk sēdēt) tas darās ierakstot /etc/rc.conf failā
sendmail_enable="YES"

 

Update:

Ieteiktu arī aizkomentēt php.ini tās 2 rindiņas pie sadaļas "For Win32 only" (kaut kā sēž prātā, ka tas kaut ko tomēr ietekmēja)

P.S. Man ir sanācis tik vienreiz ar mail() ņemties un jau minēju, kas man bija par vainu (nebija iestartēts Sendmail). Un starp citu tikko piefiksēju PHP manuālī šo teikumu ->

For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time.
Iespējams, ka PHP pa taisno vēršās pie Sendmail funkcijas mail(). Edited by Didulis
Link to comment
Share on other sites

×
×
  • Create New...