Roundcube Mailbox isn't a valid mbox file - php

When I login to my local Roundcube mail client from the web browser, it shows empty Inbox/Sent folders with an error message. I'm using php7.3, nginx, mysql as a local tech stack.
Server error: STATUS: Mailbox isn't a valid mbox file (0.000 + 0.000
secs).
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

After a long investigation, I found the solution.
I just removed the leading line break from the file
/var/spool/mail/{YOUR_USERNAME}
And it worked like a charm.

Related

MAMP server configuration error + PHP & MySQL error

I'm attempting to use MAMP on a windows laptop, so I can run a JavaScript experiment for my Phd. Unfortunately I can't seem to get past startup.When I open Mamp and select 'Start Servers' the following message pops up:
MAMP could not start servers as configuration is not valid. Please check logs...
Despite this message the Apache Server and My SQL Server boxes turn green to suggest they are active.
After looking through a few logs I find the following errors, but I'm not sure how to address or fix them.
Apache_error.log
[Sat Mar 03 08:10:15 2018] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
Php_error.log
[02-Mar-2018 21:10:22 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\MAMP\bin\php\php7.1.7\ext\php_imagick.dll' - The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
in Unknown on line 0
Mampapp.log
textMessage:The description for Event ID '-1073741724' in Source 'MySQL' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event:'D:\MAMP\bin\mysql\bin\mysqld.exe: ready for connections.
Version: '5.6.34-log' socket: '' port: 3306 MySQL Community Server (GPL)
'
Source:MySQL
Category:(0)
EntryType:Information
EventID:100
Thanks, any help is appreciated.
MAMP is for mac specific. You would better take Xamp cross-platform (personal recommendation) or Wamp that is windows specific.

Permission denied while using PHP Mail using Postfix

I have installed postfix and dovecot properly and did all configurations as per this guide: http://www.krizna.com/ubuntu/setup-mail-server-ubuntu-14-04/
But when I try sending mail via terminal like:
sudo php -r "mail('xyz#xyz.com', 'test', 'test');"
It gives me the error
sh: 1: /etc/postfix: Permission denied
I tried doing chmod -R 777 to the /etc/postfix directory and I still get the same error.
What should I do to get this working? I just want to send mail from my server to other mails like Gmail (i.e. xyz#xyz.com to abc#gmail.com)
I have even configured the mx records and a records in my dns manager.
If I see the Postfix log, I have this:
Feb 2 12:30:33 myhost postfix/pickup[16695]: ED7A120FD3: uid=33 from=<www-data>
Feb 2 12:30:33 myhost postfix/cleanup[4891]: ED7A120FD3: message-id=<20160202173033.ED7A120FD3#xyz.com>
Feb 2 12:30:33 myhost postfix/cleanup[4891]: warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory
Feb 2 12:30:33 myhost postfix/cleanup[4891]: warning: hash:/etc/postfix/virtual lookup error for "xyz#xyz.com"
Feb 2 12:30:33 myhost postfix/cleanup[4891]: warning: ED7A120FD3: virtual_alias_maps map lookup problem for xyz#xyz.com -- message not accepted, try again later
I am using PHP 7 running Apache 2 on Ubuntu 14.04
(Note: Postfix and dovecot seems to be working cause I did telnet as given in the tutorial and got the correct response.)
You forgot to run sudo postmap /etc/postfix/virtual.
Got my problem solved. The permission error occured only when accessing Postfix from terminal. It works when accessed from PHP script.
Moreover, I had to modify PHP.ini sendmail path which I set as /etc/postfix before.

PHP ldap_connect using ldaps to connect to Active Directory getting Unknown CA error

I am trying to connect to MS Active Directory using PHP 7 on a Windows 2012 server (running apache 2.4 but that should be irrelevant to the problem I am having).
I should also note that I am able to connect to AD from PHP using non-secure LDAP from the command line and the apache server.
When I execute the following PHP test file, source: http://muzso.hu/2012/04/02/php-ldap-ssl-ldaps-authentication-in-windows-running-apache, from a command line on the web server:
$AD_search_bind_DN = 'CN=someuser,OU=Users,DC=example,DC=com';
$AD_search_bind_PW = 'secret123';
ini_set('display_errors', 1);
error_reporting(E_ALL);
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$conn = ldap_connect('ldaps://SomeDC.example.com/') or die("Failed to connect to ldap server.");
ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_bind($conn, $AD_search_bind_DN, $AD_search_bind_PW) or die("Failed to bind to ldap server: " + ldap_error($conn));
echo "Successful LDAP bind.";
I get the following output (I highlighted the error):
ldap_url_parse_ext(ldap://localhost/)
ldap_init: trying %SYSCONFDIR%\ldap.conf
ldap_init: HOME env is NULL
ldap_init: trying ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
ldap_create
ldap_url_parse_ext(ldaps://SomeDC.example.com/)
ldap_sasl_bind_s
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP SomeDC.example.com:636
ldap_new_socket: 244
ldap_prepare_socket: 244
ldap_connect_to_host: Trying {IP Address of SomeDC Removed}:636
ldap_pvt_connect: fd: 244 tm: -1 async: 0
attempting to connect:
connect success
TLS trace: SSL_connect:before/connect initialization
TLS trace: SSL_connect:SSLv2/v3 write client hello A
TLS trace: SSL_connect:SSLv3 read server hello A
TLS certificate verification: depth: 1, err: 20, subject: /DC=com/DC=example/C
N=Self_Named-SHA256-SubCA, issuer: /CN=ITSS-Ent-SHA256-Root
TLS certificate verification: Error, unable to get local issuer certificate
TLS trace: SSL3 alert write:fatal:unknown CA
TLS trace: SSL_connect:error in error
TLS trace: SSL_connect:error in error
TLS: can't connect: error:14090086:SSL
routines:ssl3_get_server_certificate:certificate verify failed (unable to get local issuer certificate).
ldap_err2string
PHP Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in C:\test_bind.php on line 10
I have both the php_ldap and php_openssl extensions UN-commented in my php.ini file.
I have copies of the AD CA cert in DER and PEM formats but I am not sure where to place these files on my web server. There are lots of posts related to linux OS's that simply say to place "TLS_CACERT C:\openldap\sysconf\cacert.pem" in my ldap.conf file. I am not running openLDAP and I do not have a ldap.conf file.
I have openSSL installed but I am not entirely sure that the configuration is correct:
The openssl.cfg file is unchanged: http://pastebin.com/KxnWThXh
I added an environment variable 'OpenSSL' that points to the openssl.cfg file
When I execute 'openssl version -a' from a cmd line, it shows: OPENSSLDIR: /usr/local/ssl which clearly makes no sense for windows.
Complete output can be seen here: http://pastebin.com/h3ei3Pwp
== EDIT 1: ========================================
Gabriel, thanks for the suggestions / Reference.
I have now also tried these things without success:
Created a ldap.conf and an openldap.conf file (Using many diferent formats based on various article suggestions, see the variations I've tried here: http://pastebin.com/aP94Nh4Y) in C:\ and C:\openldap\sysconf
This article (https://www.reddit.com/r/PHPhelp/comments/3tykpc/php_7_and_ldap/) says to create an environment variable called 'LDAPCONF' that points to the ldap.conf file (C:\openldap\sysconf\ldap.conf). I did. No change.
I noticed this in the output from executing my test php script (line 2 of the output): ldap_init: trying %SYSCONFDIR%\ldap.conf. The SYSCONFDIR environment variable didn't yet exist so I added that one with a value of 'C:\openldap\sysconf\'. -- no change.
Introduced an obvious syntax error into all locations of my ldap.conf/openldap.conf files to see if I could change the test script output to know that it was at least looking at one of those files -- nothing changed.
== EDIT 2: ========================================
Gabriel, thanks for the process monitor tip. I can now at least confirm that PHP 7 is using the 'LDAPCONF' environment value path to locate and read the ldap.conf file that this ENV variable is pointing to.
It also appears that PHP 7 is not handling the 'SYSCONFDIR' environment variable correctly because it first tries to open a file in this literal path: E:\httpd\www\%SYSCONFDIR%\ldap.conf
It's still not working but now I can focus my effort in tweaking just the one file I know it is reading.
If anyone has any other tips for configuration or could share their ldap.conf file from a working windows installation I would appreciate it.
I am now still stuck and don't know what else to do. Please help!
The answer here should help: https://stackoverflow.com/a/6047293/1202807
Under XAMPP on Windows the ldap.conf must be either in the root of the
system (c:\ldap.conf, PHP 5.3.3 if I remember correctly) or in
C:\openldap\sysconf\ depending on the PHP version. It seems the path
is not configurable because hardcoded in the Windows PHP DLLs. See the
comments at http://se2.php.net/manual/en/ref.ldap.php
So create the ldap.conf file in c:\ or C:\openldap\sysconf\ if it doesn't exist already, and put your TLS_CACERT line in it.
I have similar problem, I have spent some time to resolve it. This behaviour was OpenLDAP bug in PHP. I have reported it and it was fixed and will be released soon. See: PHP BUG #73243 (https://bugs.php.net/bug.php?id=73243)
If you need immediate fix, which is a little bit hacking, try this (on your own risk):
use some binary editor (e.g. HexEdit) to edit php_ldap.dll
find the expression "%SYSCONFDIR%\ldap.conf" and
replace it with "c:\ldap_conf\ldap.conf", the new constant has to have the same length as the replaced constant
copy the ldap configuration to new location
Hope, it helps :-)

Nginx and Aegir installation on Ubuntu fails

I am installing Aegir with Nginx on vanilla Ubuntu 14.04 VPS following:
http://community.aegirproject.org/content/installing/manual/nginx-mariadb-php-fpm-single-server-installation
At the very end, during Aegir install I get following error:
Could not rsync from '/var/aegir/config/server_master/nginx/subdir.d' to 'aegir# nginx.drophost.eu:/' [error]
/var/aegir/config/server_master/nginx/subdir.d could not be synced to remote server nginx.drophost.eu. Changes might not be available[error]
until this has been done. (error: ssh: Could not resolve hostname nginx.drophost.eu: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0])
Server domain is nginx.drophost.eu and it resolves correctly to server IP, so what's wrong?

Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195'

I sucessfully run the APNS code in my macbook air, but it turns out that I can not run it in my other computer:
I checked that these are the same:
1. .pem file ( to be specific )
2. Program
The computers can not work are:
Windows 7,XAMPP,OpenSSL supported,No firewall
And
EC2 Linux server with 2195 and 2196 opened
What might be other issues causing that I got this error in my php code?
Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195'
I know there might be cause by not opening SSL, but I checked the phpInfo(), it should be correct.
openssl
OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.0.1c 10 May 2012
OpenSSL Header Version OpenSSL 0.9.8x
I tried telnet in EC2 server, it gives:
telnet gateway.push.apple.com 2195
Trying 17.149.36.239...
Connected to gateway.push-apple.com.akadns.net.
Escape character is '^]'.
In case of MAC,
(built-in server was working fine using terminal but not through browser, for me, so i installed MAMP.)
1.Go to---> /Library/WebServer/Documents/----copy both php and ckdev.pem file here.
2 go to terminal-->$open /private/etc-->go to--->apache2>originals>httpd.config file-->
**"#LoadModule php5_module libexec/apache2/libphp5.so", remove "#"..(perhaps, you would have to change the permission also..!)
then goto browser and check--> localhost/yourPhpFile.php
In Case of Windows system,
1.Install WAMP,
2.goto php.ini file--->search for this ";extension=php_openssl.dll" line and remove semicolon ";".
3.click WAMP icon from right-bottom goto PHP>PHP Extensions>select php_openssl..
That's it..hope this may help further seekers.
if you are getting an error like this "Unable to find the socket transport “ssl” – did you forget to enable it
when you configured PHP?" then follow the next step
if php has not got ssl enabled then goto php.ini and change this to ";extension=php_openssl.dll"
"extension=php_openssl.dll" (remove the semicolon) and save it and run the program.
Thanks for help, so far I solved the solution.
The problem is that I used the same pem file for both my cert and the root cert.
There is a root cert that is different from my own cert, during connection, both cert is used so I have to get the root cert of apple push notification.
Thanks!

Categories