Hello there,
just to add a few notes, which may be useful:
1. xDebugxDebug allows you to debug PHP code. It is a PHP extension, which can be used within
CLI but also Apache. You can set breakpoints and watch variables, like used from normal
debuggers when programming e.g. C/C++/Java.
You can define how to connect and so on, I may recommend to use ssh port forwarding
if you want to debug on external server, since xDebug builds by default a listener on port 9000
and only accepts local host requests.
You can find tutorials for NetBeans/Eclipse in the net, if you want to get a little bit more serious
I can only recommend to get PHPStorm from JetBrains, which is still my favorite IDE.
2. Server EnviromentIf you are setting up a server, please remember to harden it.
Some fancy things you may want to consider:
2.1 Server TokensBy default the ServerTokens are set to Full, when I remember correct.
However:
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
I guess you don't want that.
Go to:
/etc/apache2/conf-avaiable/security.conf
And change it to:
ServerTokens Prod
2.2 ServerSignature# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
Nope, thanks.
Same file as above:
From:
ServerSignature On
To:
ServerSignature Off
2.3 PHP InfoThere is a "neat" feature in the php.ini:
; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
; http://php.net/expose-php
expose_php = Off
Change it to off. It's located in /etc/php5/apache2/php.ini
2.4 Disable Functions In most cases you don't want to allow exec(); and system(); on your service, disable it using:
; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions =
You can enable it using vHosts also.
2.5 Open BasedirPLEASE enable Open Basedir per virtual host. This denies access from the webserver to the
system, it's such a simple tweak and still isn't done quite often. This just weakens LFI by quite a bit.
-----------------------------------------------------------------------------------------------------------
Resistor:
That guide was quite useful to set up a nice webserver.
https://www.exratione.com/2014/05/a-mailserver-on-ubuntu-1404-postfix-dovecot-mysql/I hope I could add something useful here.
Best Regards,
Schalla
//EDIT
The WYSWYG Editor fucked up the syntax somehow.