2007/10/11

PHP Mail function

I post this few years ago at php site, but post was removed by maintainers.
-----------------------------------------------------
Linux
Known situation mail() not work, but why ???

Try send a simple mail from shell
root@alpha:~# sendmail xxx@yyy.com
strange error ???

collect: Cannot write ./dfg35A7vav022304 (bfcommit, uid=XXX, gid=XXX): Permission denied

queueup: cannot create queue temp file ./tfg35A7vav022304, uid=XXX: Permission denied

Don't mess with permissons on /var/spool
/var/mail /var/spool/mqueue
Just set them follow the instructions from sendmail readme
It seems that when sendmail runs not like a daemon ( without -bd or -bD options ) it doesn't use corect QueueDirectory from /etc/mail/sendmail.cf

The solution is

set this line in php.ini
;For Unix only.You may supply arguments as well (default:'sendmail -t -i').

sendmail_path="/usr/sbin/sendmail -t -i -OQueueDirectory=/var/spool/mqueue/"

That's all. mail() now work fine ))
Hope this will save up somebody's time, because i spent a lot of hours in digging and tearing my hair (and my mother will colapse if she hear what a words i use ))

Running DotNetNuke at Apache HTTPD and mod_aspdotnet

Prerequisites :
  1. Apache win32 binaries from Apache Download Mirrors
  2. ASP.NET module for Apache HTTP Server 2.x from sourceforge
  3. DotNetNuke Downloads


Config : Apache (out of scope of this article)

Config : mod_aspdotnet


# enable the Apache HTTP Server to correctly serve ASP.NET application content
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo</span>

<ifmodule aspdotnet_module>
# ----------------------------------------------------------------
# Enables mod_aspdotnet to process ASP.NET content
# ----------------------------------------------------------------
AspNet Files Directories Virtual

# ----------------------------------------------------------------
# Mount the ASP.NET application
# ----------------------------------------------------------------
AspNetMount /portal "<path to DotNetNuke>"

# ----------------------------------------------------------------
# Map all requests for to the application files
# ----------------------------------------------------------------
Alias /portal "<path to DotNetNuke>"

# ----------------------------------------------------------------
# Allow asp.net scripts to be executed
# ----------------------------------------------------------------
<directory <path to DotNetNuke>>
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex index.htm index.aspx Default.aspx default.aspx
#default the index page to .htm and .aspx
</directory>


# ----------------------------------------------------------------
# For all virtual ASP.NET webs, we need the aspnet_client files
# to serve the client-side helper scripts.
# ----------------------------------------------------------------
AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"

# ----------------------------------------------------------------
<directory windows="" net="" framework="" netclientfiles="">
Options FollowSymlinks
Order allow,deny
Allow from all
</directory>
# ----------------------------------------------------------------
</ifmodule>
#asp.net



    Troubleshooting :
  1. AspNet Files Directories Virtual
    This directive not included in most standard mod_aspdotnet configs. If you omit it Apache will be unable to serve virtual resources like WebResource.axd from aspnet_isapi.dll. This will affect in
    mod_aspdotnet: Forbidden, 'AspNet Virtual'is not enabled for: .../WebResource.axd
    error in apache log and
    WebForm_PostBackOptions is undefined
    in DotNetNuke pages.
  2. In Host » Host Settings » Friendly Url Settings turn off "Use Friendly Urls?"
    If you omit this step apache will replace all ~ in DotNetNuke friendly URL with "Home". Probably i'll resolve this later with Apache Module mod_rewrite.