Archive

Posts Tagged ‘linux’

Install sublime on Ubuntu

June 22, 2017 Leave a comment

Sublime is a very popular editor, it is very easy to use and very lightweight.
Sublime site https://www.sublimetext.com/

Installation of sublime is very simple on linux.

For Sublime-Text-2:

$ sudo add-apt-repository ppa:webupd8team/sublime-text-2
$ sudo apt-get update
$ sudo apt-get install sublime-text

For Sublime-Text-3:

$ sudo add-apt-repository ppa:webupd8team/sublime-text-3
$ sudo apt-get update
$ sudo apt-get install sublime-text-installer

Advertisements

OPcache

December 20, 2014 Leave a comment

OPcache is bundled with PHP 5.5.0 and later, and is available in PECL for lower PHP version.
OPcache improves PHP performance. OPcache stores precompiled script bytecode in shared memory on first request. When next request comes then PHP does not compile that script, it uses precompiled script from OPcache.
cache opcache_reset() OPcache offers a function to reset.
pcache_invalidate ( string $script [, boolean $force = FALSE ] ) This function invalidate a script.

Enable OPcache on linux: To enable OPcache on linux uncommment or add this line in php.ini zend_extension=opcache.so if this not enable OPcache on server then put full path of opcache.so

OPcache configuration: You can change OPcache configuration from php.ini. Some important configuration setting are
1. opcache.revalidate_freq=60
Here 60 is seconds. OPcache validate cache after given seconds.

2. opcache.max_accelerated_files=7000
This is number of script sotre in OPcache. You can change this number as you needed.

To see OPcache configuratin and status you need a script on same server. Opcache-gui is the good script.

Resources:
PHP.net
Scaling PHP Book
Appdynamics

Categories: php Tags: , , , , , , ,

How to install xampp/lampp on centos (linux)

June 27, 2013 Leave a comment

How to install xampp/lampp on centos (linux)

The installation procedure here is based on CentOS 6.x workstation default installation. Follow these steps
1. Log in linux terminal

2. Change user to root. Write below command and press enter and enter root user password.

#su

3. The default installation of CentOS lacks some of the libraries that XAMPP needs to run, including 32 bit compatibility libraries.
To get them you su to root then use this yum command.

#yum -y install glibc* libstd* ld-linux.so.2

4. Download and install the latest verions from the XAMPP, from the XAMPP download page. Upload this file to server /opt/ directory.

5. Unpack tar file

#tar zxvf xampp-linux-1.8.1.tar.gz /opt/

6. Change the ownership of all the xampp files to be nobody:root.

#chown nobody:root /opt/lampp/ -R

7. XAMPP was designed to run on 32 bit operating systems. The start up script will prevent xampp from starting up if you are running on a 64 bit system which isn’t necessary since you installed 32 bit compatibility libraries in step 1. To get around this restriction, open /opt/lampp/lampp in an editor and comment out the following lines.

# XAMPP is currently 32 bit only
#case `uname -m` in
# *_64)
# if /opt/lampp/bin/php -v > /dev/null 2>&1
# then
# :
# else
# $de && echo “XAMPP gibt es zur Zeit nur als 32-Bit Applikation.
# Bitte verwende eine 32-Bit Kompatibilitaetsbibliothek fuer Dein
# System.”
#
# $de || echo “XAMPP is currently only availably as 32 bit
# application. Please use a 32 bit compatibility library for
# your system.”
#
# exit
# fi
# ;;
#esac

8. Open /opt/lampp/etc/etc/extra/httpd-xampp.conf in an editor. Replace the “Deny from all” statement with “Require all grant” in the stanza. You can also comment out the “Allow from…” line if you don’t want to accept connections from any external system.

Order deny, allow
# Deny from all
Require all granted
# Allow from ::1 127.0.0.0/8 \
# fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
# fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

9. Start up xampp
#/opt/lampp/lampp start

10. To fix most of the security weaknesses in xampp simply call the following command

#/opt/lampp/lampp security

It will ask you to change password. Set all pasword.

11. Open http://localhost in a browser. You should a get a browser window with the XAMPP for Linux startup screen.

12. Open /opt/lampp/lampp/phpmyadmin/config.inc.php in your editor of choice

13. Change the authentication type as follows:

$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’

14. Add the following lines in the config.inc.php file.

$cfg[‘Servers’][$i][‘table_uiprefs’] = ‘pma_table_uiprefs’;
$cfg[‘Servers’][$i][‘recent’] = ‘pma_recent’;

15. Close your browser then restart Apache and MySQL in the XAMPP Control Panel.

#/opt/lampp/lampp restart

17. At this point most of the setup work for XAMPP is done. However, if you plan to use phpyMyAdmin you’ll have to do a little further configuration to get it to work properly. XAMPP does not create all the tables that phpmyadmin needs so you have to do this with an SQL script that is enclosed with the package. To do this click on the Import tab in phpmyadmin. Choose the create_tables.sql script in /opt/lampp/lampp/phpmyadmin/examples directory and press go button.

18. If website is not open. Then check port 80 on centOs. dport port 80 by following command.

# sudo iptables -I INPUT -p tcp –dport 80 -j ACCEPT
# sudo service iptables save

19. For ftp dport 21 port

# sudo iptables -I INPUT -p tcp –dport 80 -j ACCEPT
# sudo service iptables save

20. [optional] Block brute force attack. Please read this http://kvz.io/blog/2007/07/28/block-brute-force-attacks-with-iptables/

Follow me on facebook

%d bloggers like this: