Virtualmin and Procmail - send incoming emails to PHP script - php

I'm running a CentOS 7 server with Virtualmin/Webmin and virtual hosts configured. I want to send all emails addressed to one specific email address hosted on this system (belonging to one virtual host) to a PHP script for processing. From research, I assume procmail is the simplest way to do this. I assume I need to create a .procmailrc file in the user's home directory.
However, this .procmailrc file does not get executed. I found instructions for enabling local .procmailrc files:
Go to Virutalmin -> Email Messages -> Spam and Virus Scanning and turn on "Allow mailbox users to create mail filters"
However, I can't get this to work. Every time I try to save the change, I get this error:
LibClamAV Warning: **************************************************
LibClamAV Warning: *** The virus database is older than 7 days! ***
LibClamAV Warning: *** Please update it as soon as possible. ***
LibClamAV Warning: **************************************************
ERROR: Can't write to temporary directory
I don't know what directory it's trying to write, and second, if I try to update clamav ("yum update clamav") I get a message: "no packages marked for update".
UPDATE: after rebooting the server, I am able to save the setting. However, it still doesn't appear that the local .procmailrc file is being executed.
Here's the .procmailrc file:
DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log.`date +%y-%m-%d`
SHELL=/bin/sh
:0
| /usr/bin/php /home/user/homes/support/mailhandler.php
The mailhandler.php file is owned by 'user' and has 744 permissions. It simply dumps the STDIN data into a log file in the same directory, with 666 permissions.
First question: is using procmail the simplest way to achieve this? If not, what is?
Second question: how can I get local .procmailrc scripts to work?
Thanks!

Related

PHP Warning: oci_connect(): ORA-28040: No matching authentication protocol

I was given a task of fixing an app after the update.
Presumably, the person who updated it said they updated it to 'Oracle 12c' - whatever that means, thought the path is: 'C:/oracle/product/11.2.0/' which sounds like it's still 11.2.0 or whatever.. not important.
Whenever I'm trying to run oci_connect(); with verified and tested credentials, the error pops:
Warning: oci_connect(): ORA-28040: No matching authentication protocol
I've searched around the internet, found 2 solutions:
download and add 'ojdbc8.jar' to 'C:\oracle\product\11.2.0\client_1\jdbc\lib' (hope the path is correct).
add the lines below to 'sqlnet' which I found in:
'C:\oracle\product...\network\admin\' and
'C:\oracle\ora92\newtork\ADMIN'
**I've changed in both to be
sure**.
The lines:
SQLNET.ALLOWED_LOGON_VERSION=8
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
Same result, neither worked.
Edit:
I've also noticed, there's no oradmin.exe nor oracle.exe in the bin folder, is this normal?
It sounds like the server is updated and now the client fails to connect. In this case the server needs to configured to allow older client to connect. Add the SQLNET parameters to the server sqlnet.ora file and restart the server.

phpsdk_deps returns fatal error on windows

To compile PHP 7.1.X on Windows I use steps written here:
https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2
When I try to update dependencies with following command:
phpsdk_deps -u
I get following error:
D:\php-sdk2\php-sdk-binary-tools\phpdev\vc14\x64_71_2\php-7.1.15-src
$ phpsdk_deps -u
Fatal error: Uncaught SDK\Exception: Failed to fetch supported
branches
This is happening for almost two weeks now.
You're having network trouble.
If you open up the Config.php file at this line, you'll see that the Config tries to load the URI https://windows.php.net/downloads/php-sdk/deps/series/, and pick the correct txt file from there, in order to download the right dependencies. The exception you get means that this cannot be properly fetched.
The solution in my case was to use the company proxy (command line wasn't using it, so it cannot properly resolve & reach the above URL, and so the Config.php gets an empty response). How to do so might change depending on the network settings you use. In my case, I simply visited the URL above in Firefox (which is properly configured by the company), opened up the network pannel, get the IP of the website from there (which is actually the IP of the proxy Firefox was told to use by the company settings), and add the IP hostname entry in my host file (C:\Windows\System32\Drivers\etc\host) so it looks like 10.1.2.3 windows.php.net
Then I rerun the Config script, and boom, it managed to retrieve the txt files and the dependencies.
Another solution can be to retrieve all the dependencies listed in the txt file that corresponds to your setup, but it's a bit tedious...

How to run a Laravel application that was not created by me on my personal server

I need to alter some of the front-end features of a Laravel application that was not created by me. The application was created using Laravel and am not sure how to get it up and running so I can alter the front-end code. I was given a copy of the source files. I then put that source files in to my xampp/htdocs folder. I started Xampp, opened the folder in Gitbash and entered PHP artisan serve. The application does not appear to be running.
Is there something I am missing or doing wrong? Please take into consideration that I did not create this application, for your information, I do know how to create and run a Laravel app locally, but am wondering if the process is different if it was not created by me personally?
Thank you all for helping me out, I appreciate you personally and this community.
Here is the error I am receiving in Gitbash:
PHP Warning:
require(C:\xampp\htdocs\appoets\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in C:\xampp\htdocs\appoets\bootstrap\autoload.php on line 17
Warning: require(C:\xampp\htdocs\appoets\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\appoets\bootstrap\autoload.php on line 17
PHP Fatal error: require(): Failed opening required
'C:\xampp\htdocs\appoets\bootstrap/../vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\appoets\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\appoets\bootstrap/../vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\appoets\bootstrap\autoload.php on line 17
Please solved this for me. If you run into the same error. Have the correct file path open in Gitbash and then run "composer install"
After that was fixed another problem popped up. I went to load Laravel in my browser and it gave a general error message no error number or anything. To fix this go to your env.example file and rename it. .env then go to the terminal or your command line and run php artisan key:generate. After this hit save all and go refresh. All should be fixed!
The errors your getting are because you haven't installed your composer dependencies. Install them with composer before running the application:
composer install
Here's the old answer before that callstack was provided. I think it's still interesting background information for you, but not immediately relevant.
It looks like you're running two web servers so I suspect you're just
confused about where the application is running.
XAMPP ships with Apache. I'd expect that running it will spin up its
web server on port 80, the default port that web browsers use.
Therefore, if you're trying to get to the application at
http://localhost, you're hitting this webserver, which might have a
different (and not set up) application on it.
Running php artisan serve will start a second web server utilizing
PHP's built in web server. According to the documentation, the
default port that this command will use is 8000:
By default the HTTP-server will listen to port 8000. However if that
port is already in use or you wish to serve multiple applications this
way, you might want to specify what port to use. Just add the --port
argument:
Therefore, you can access the application without XAMPP though this
url: http://localhost:8000
Try both URLs.
Note that php artisan serve doesn't start up a MySQL server. You
will still need XAMPP to start the MySQL server if you're using a
database.
Checklist for your issue
1. composer update --no-scripts or composer install
2. php artisan key:generate
3. rename example.env to .env
4. Change database credentials, set debug mode! Change app url
4. php artisan migrate(make sure u have the database running in the server)
5. php artisan config:clear
6. you are good to go!

Different result for same page on different ports : cakephp

I am new to cakephp, and following the 'Bookmarkers Tutorial'. I get to know that I can access the project using two kind of urls(I am using apache and the folder is located at /var/www/html/bookmarker):
localhost:8765
and
localhost/bookmarker
Now, when I use the first url, I get the following warning message on top:
warning(2) : file_put_contents(/var/www/html/bookmarker/logs/error.log): failed to
open stream: Permission denied [CORE/src/Log/Engine/FileLog.php, line
133]
But is not the case with the second url !
Why is there such a difference b/w these two urls? Which one should be used? And how to resolve that message appearance? Any help is greatly appreciated!
It's two servers here.
"localhost:8765" is the server built-in by CakePHP when you run the command: "bin/cake server" but you already have Apache web server at "localhost", so you don't need it.
And 2 servers being ran by 2 users:
localhost:8765 is you
localhost is apache
That's why you don't have permission to write log file (owned by apache)
Just stop the server built-in (bin/cake server), and use Apache server (2nd URL)
In case you want to use the server built-in, stop Apache server and remove everything inside "/var/www/html/bookmarker/logs/", the error message will gone.

PHP - fopen($url) failed to open stream: Permission denied in

I have to website with a very similar php configuration (actually on the same hosting account), with almost identical php code and with identical file structure. At some point, I call fopen(http://example.com/rssfedd.xml) to retrieve a RSS feed.
on http://sfdmorin.com/accueil/index.php everything works fine, on http://danielpoiriergda.ca/accueil/index.php i get:
Warning: fopen(http://affaires.lapresse.ca/rss/2399.xml)
[function.fopen]: failed to open stream: Permission denied in
/var/www/vhosts/danielpoiriergda.ca/httpdocs/snippet/lastRSS.php on
line 143
$f = fopen("http://affaires.lapresse.ca/rss/2399.xml", 'r');
Both website have php debug mode enabled and both have the same permissions for file and folders.
Both info.php have *allow_url_fopen* enabled for local and master value
Here are the major differences I found on both phpinfo() file:
not working site: Server API CGI/FastCGI
working site: Server API Apache 2.0 Handler
and on the working site there are no php.ini file in the path given by the loaded configuration file field
EDIT:
I know this thread is probably dead, but not the problem.
I check, with Netbeans fill diff, all the PHP code and php.ini are exactly the same on both domain.
I know similar questions were ask, but they did not help me.
Thank you!
Finally, I contacted my webserver tech support and they solve the problem. They did by:
adding an exception to SELinux
I dont have a clue wwhat SELinux is or what they did specificaly.

Categories