Thursday, May 24, 2018

Raspberry Pi PHP Http Proxy

This post is about how to setup your Raspberry Pi to be a web server and work as a Http Proxy on internet.

I"m using a Raspberry Pi 3.

You need:

1, install Apache and PHP
2, install Athlon1600/php-proxy-app
3, port forwarding on your modem / router
4, use HTTPS (optional)
5, use dynamic DNS (optional)

1, install Apache and PHP
https://www.stewright.me/2016/03/turn-raspberry-pi-3-php-7-powered-web-server

Step 1 – Add new repository sources

At the time of writing, PHP 7.0 hasn’t yet made the official repository sources, so we need to add one which provides us with the PHP 7.0 packages. Edit your sources file with this command:
sudo nano /etc/apt/sources.list
Below the existing entries in the file on a blank line, add the following two lines:
deb http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free
#deb-src http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free
Your file should look a little like this:
Install Apache 2 and PHP 7 on Raspberry Pi 3
Next we need to add a couple of certificates in order to allow us to use the sources with apt-get. Run the following two commands:
sudo gpg --keyserver pgpkeys.mit.edu --recv-key CCD91D6111A06851
sudo gpg --armor --export CCD91D6111A06851 | sudo apt-key add -
And finally we need to update the package list by running:
sudo apt-get update

Step 2 – Install the core Apache2 and PHP 7 packages

We’re ready to install Apache2 and PHP7, along with some common packages that we may need for most web applications such as Symfony2, WordPress, Drupal etc. Run the following command to install these packages:
apt-get install apache2 php7.0 php7.0-curl php7.0-gd php7.0-imap php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-xmlrpc libapache2-mod-php7.0
This may take a little time, but as soon as we’re done, we are essentially finished.

Step 3 – Test Apache2 and PHP 7

Assuming all went well, we’re ready to test to see if everything went OK with the installation. First we’ll test the version of PHP that CLI is using:
php -v
You should see something like this:
Install PHP 7 on Raspbian
Next we’ll test two things; Apache2 and PHP 7. In your web browser, visit the IP address of your Raspberry Pi. If you haven’t used ssh and have followed these steps on your Raspberry Pi 3 itself, just visit http://127.0.0.1, otherwise change 127.0.0.1 for the IP address of your Raspberry Pi.
You should see the default Debian holding page:
Turn Raspberry Pi into a web server
Next we’ll test PHP. Run the following command to create a test file:
echo "> /var/www/html/phpinfo.php
Yet again, visit the IP address of your Raspberry Pi, this time adding /phpinfo.php to the URL. You should see the PHP Information.

Tips: if you got error of cUrl extension not installed, you can do:
sudo apt-get install php-curl
sudo service apache2 restart
reference: https://stackoverflow.com/questions/33775897/how-do-i-install-the-ext-curl-extension-with-php-7?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

2, install Athlon1600/php-proxy-app

https://github.com/Athlon1600/php-proxy-app

3, port forwarding on your modem / router

https://maker.pro/raspberry-pi/projects/raspberry-pi-web-server

4, use HTTPS (optional)

https://variax.wordpress.com/2017/03/18/adding-https-to-the-raspberry-pi-apache-web-server/comment-page-1/

5, use dynamic DNS (optional)

https://desec.io/#!/en/docs/dyndns-client#option2

Thursday, May 17, 2018

ReportCrash High CPU & How to Disable reportcrash in Mac OSX - Gregory Varghese

ReportCrash High CPU & How to Disable reportcrash in Mac OSX - Gregory Varghese



For a while now, all of my MacBooks have run extremely hot and the fans have gone nuts. While troubleshooting the issue, Activity Monitor showed that an app named reportcrash has run very high on the CPU and has killed my battery life. Force quitting the app didn’t help as it would start right back up in a few seconds and climb back to 80-100% usage of the CPU.

What is CrashReporter?

CrashReporter runs in any time an application crashes and it’s designed to saves the application state to aid developers in working out why the app crashed. Basically a process is launching, crashing (and invoking CrashReporter) and then re-launching, repeating this cycle never ending.

How to Identify What’s Crashing

To show which process is triggering this cycle and stop it, CrashReporter is pretty verbose in its logging which makes finding the problem app somewhat easier. Open up the console.app (/Applications/Utilities/Console.app) and look towards the end of your system.log to see what app is crashing.
Unfortunately for me, the problem is a driver by some company called EFI and getting the latest drivers didn’t resolve the issue. The next obvious solution was to disable reportcrash.

How to Disable ReportCrash

Fire up terminal and run the following commands to disable reportcrash:

How to Enable ReportCrash

If you need to reenable crash report, run the following commands in terminal: