http://x.x.x.x/fpmstatus.php?full
systemctl restart php-fpm
http://x.x.x.x/fpmstatus.php?full
systemctl restart php-fpm
This is a purify function to ensure user-inputed string is sanitized and prevent XSS kind of attacks.
function purify($input){ $result = ""; if (isset($input) && !empty($input)) { $result = rawurldecode($input); $result = strip_tags($result); $result = stripcslashes($result); $result = htmlspecialchars($result, ENT_QUOTES); $result = iconv('utf-8','utf-8//IGNORE',$result); } return $result; }
The following PHP code snippet will return client IP address.
function get_client_ip() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if(getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if(getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWARDED'); else if(getenv('HTTP_FORWARDED_FOR')) $ipaddress = getenv('HTTP_FORWARDED_FOR'); else if(getenv('HTTP_FORWARDED')) $ipaddress = getenv('HTTP_FORWARDED'); else if(getenv('REMOTE_ADDR')) $ipaddress = getenv('REMOTE_ADDR'); else $ipaddress = 'UNKNOWN'; return $ipaddress; }
In order to compile PHP on a 64 bit platform, you will need to include the following configure option
–with-libdir=lib64
if ($_SERVER[‘HTTPS’] != “on”) {
$url = “https://”. $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];??? ?header(“Location: $url”);
exit;
}
If you don’t have access to the php.ini or have issue setting up .htaccess to enable error reporting.
You can try the following code
ini_set( ‘display_errors’, true );
error_reporting( E_ALL );
Found a nice article on how to integrate mod_geoip in PHP.
http://blackonsole.blogspot.com/2009/02/install-and-configure-geoip-on-opensuse.html
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz
wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz
apxs2 -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
IfModule mod_geoip.cGeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.datIfModule
$country_code = apache_note("GEOIP_COUNTRY_CODE");
print "Code : " . $country_code . "
";
$country_name = apache_note("GEOIP_COUNTRY_NAME");
print "Country: " . $country_name . "
";
I am working on a project to allow full-text indexing of common file types such as word, powerpoint, excel and pdf. After searching for a few days, I have a hard time finding a perfect solution.
Word
http://ftp.wagner.pp.ru/~vitus/software/catdoc/
Excel
http://ftp.wagner.pp.ru/~vitus/software/catdoc/
PowerPoint
This is a sample code to parse a config file in PHP
$mosConfig_CONFIG_IDE=Y
$mosConfig_HOST=localhost
while (!feof($fp)) {
$line = trim(fgets($fp));
if (ereg('\$mosConfig_', $line)) {
$line = ereg_replace ('\$mosConfig_',"",$line);
$pieces = explode("=", $line);
$option = trim($pieces[0]);
$value = trim($pieces[1]);
$value = ereg_replace ("^\'","",$value);
$value = ereg_replace ("\'\;$","",$value);
$config_values[$option] = $value;
}
}
fclose($fp);
Installing Apache 2.x
./configure \
--prefix=/usr/local/apache \
--enable-info \
--enable-rewrite \
--enable-ssl \
--enable-unique-id \
--enable-deflate \
--enable-usertrack \
--enable-so
make
make install
cp build/rpm/httpd.init /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 3456 httpd on
Installing PHP required Libraries
http://www.ijg.org/files/jpegsrc.v6b.tar.gz
./configure --enable-shared
mkdir -p /usr/local/man/man1
make
make install
http://www.libpng.org/pub/png/libpng.html
./configure
make
make install
http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz
./configure
make
make test
make install
Install LibMCrypt
http://sourceforge.net/projects/mcrypt
./configure
make
make install
Installing PHP5
./configure \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-openssl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--with-ttf \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-mcrypt \
--enable-mbstring \
--enable-bcmath
make
make install
Configuring Apache for PHP
vi /usr/local/apache/conf/httpd.confadd
AddType application/x-httpd-php .phpchange
DirectoryIndex index.php index.html index.html.varphp.ini
copy php.ini-development or php.ini-production to /usr/local/lib/php.iniedit /usr/local/lib/php.ini
timezone = Asia/HongKong