Coding - Knowledge Base Archives - Hivelocity Hosting https://www.hivelocity.net/kb/category/coding/ Dedicated Servers, Private Cloud & Colocation Thu, 11 Jan 2024 21:33:13 +0000 en-US hourly 1 https://wordpress.org/?v=6.6 How to Install PIP on CentOS 7 https://www.hivelocity.net/kb/how-to-install-pip-on-centos-7/ Wed, 22 May 2019 19:42:39 +0000 https://www.hivelocity.net/?post_type=hv_knowledgebase&p=11881 In this guide we’ll be covering the process to install PIP on CentOS 7 using the command line. By following these 7 simple steps, you can install PIP quickly and easily. What is PIP? PIP stands for Pip Installs Packages. It is a package manager for the Python programming language that allows you to download …

How to Install PIP on CentOS 7 Read More »

The post How to Install PIP on CentOS 7 appeared first on Hivelocity Hosting.

]]>
In this guide we’ll be covering the process to install PIP on CentOS 7 using the command line. By following these 7 simple steps, you can install PIP quickly and easily.

What is PIP?

PIP stands for Pip Installs Packages. It is a package manager for the Python programming language that allows you to download and install Python packages and their dependencies on a Linux system. It is similar to a Linux distribution’s package manager, but it is specifically designed for Python packages. PIP can be installed on any major Linux distribution and is available for both Python 2 and Python 3. Once installed, PIP can be used on the command line to download and install Python packages and their dependencies.

 

Installing PIP on CentOS 7

To begin, you first need to log in and connect to your server via SSH. See here for common SSH clients:

SSH client utilities (Free):

PuTTY:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Bitvise SSH client:
https://www.bitvise.com/ssh-client-download

KiTTY:
https://www.9bis.net/kitty/

MobaXterm (Free with available Paid Pro version):
https://mobaxterm.mobatek.net/

SmarTTY:
https://sysprogs.com/SmarTTY/

Solar-PuTTY (Free with available paid versions):
https://www.solarwinds.com/free-tools/solar-putty

There are many others available out there as well.

  1. Next, log in to your CentOS 7 server with root user using your favorite SSH client
  2. Once logged in, add/install the EPEL repository with the command:

    yum install epel-release

    The image below shows what the command and its results should look like.
    Terminal window highlighting the "yum install epel-release" command
    Terminal window highlighting the result of "yum install epel-release" command

  3. Update the packages to ensure all recently added repos software is pulled and installed, as well as updating any other out of date software. Use the command below which will update all installed packages without prompting you for approval.

    yum –y update

    Terminal window highlighting the "yum -y update" command

  4. The last step is to install python-PIP and any other required packages using the command:

    yum -y install python-pip

    Terminal window highlighting the command "yum -y install python-pip"

  5. Now, verify the installation has been completed successfully with the command:
    pip –V

    Terminal window showing the results of the "pip -V" command confirming PIP has been installed

If all went well and you are seeing the above output, then you should now be ready to use PIP.

And there you have it! Now that you’ve successfully installed PIP on CentOS, you’re ready to start using python-based software.

 

Looking for more information on CentOS? Search our Knowledge Base!

 

The post How to Install PIP on CentOS 7 appeared first on Hivelocity Hosting.

]]>
Steps to install Perl on a Linux dedicated server https://www.hivelocity.net/kb/steps-to-install-perl-on-a-linux-dedicated-server/ https://www.hivelocity.net/kb/steps-to-install-perl-on-a-linux-dedicated-server/#respond Wed, 30 Jan 2013 14:20:27 +0000 https://kb.hivelocity.net/?p=11101 Please refer the following steps: 1. Login to your server as root user. 2.Fire the following commands: wget https://layer1.cpanel.net/perl588installer.tar.gz tar -xvzf perl588installer.tar.gz cd perl588installer ./install You are done with installing Perl on your server.

The post Steps to install Perl on a Linux dedicated server appeared first on Hivelocity Hosting.

]]>
Please refer the following steps:

1. Login to your server as root user.

2.Fire the following commands:

wget https://layer1.cpanel.net/perl588installer.tar.gz
tar -xvzf perl588installer.tar.gz
cd perl588installer
./install

You are done with installing Perl on your server.

The post Steps to install Perl on a Linux dedicated server appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/steps-to-install-perl-on-a-linux-dedicated-server/feed/ 0
How to Install Alternative PHP Cache (APC) on your Server? https://www.hivelocity.net/kb/how-to-install-alternative-php-cache-apc-on-your-server/ https://www.hivelocity.net/kb/how-to-install-alternative-php-cache-apc-on-your-server/#respond Wed, 30 Jan 2013 14:19:04 +0000 https://kb.hivelocity.net/?p=11095 Step a: Login to your server as root.   Step b: Download the APC wget https://pecl.php.net/package/APC   eg : wget https://pecl.php.net/get/APC-3.0.15.tgz   Step c: Extract it over to your server tar -xzf APC-3.0.15.tgz cd APC* Step d: Check the PHP location by running the below command: which php Step e: Create the configuration files using …

How to Install Alternative PHP Cache (APC) on your Server? Read More »

The post How to Install Alternative PHP Cache (APC) on your Server? appeared first on Hivelocity Hosting.

]]>
Step a: Login to your server as root.

 

Step b: Download the APC

wget https://pecl.php.net/package/APC

 

eg : wget https://pecl.php.net/get/APC-3.0.15.tgz

 

Step c: Extract it over to your server

tar -xzf APC-3.0.15.tgz

cd APC*

Step d: Check the PHP location by running the below command:

which php

Step e: Create the configuration files using the below command

Phpize

Stepf: Now the APC need to be compiled over the server :

./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config

make

make install

Note : You must install the APC in the php.ini file

Step g: Below command would help you to find the php.ini over the server :

php -i | grep php.ini

Step h : Amend php.ini by adding APC extension, as stated below :

vi /usr/local/Zend/etc/php.ini

Step I : Add the following to the php.ini file

apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1

Step J : Restart apache

service httpd restart

The post How to Install Alternative PHP Cache (APC) on your Server? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-to-install-alternative-php-cache-apc-on-your-server/feed/ 0
How do I install Suhosin under different Linux Distributions? (RHEL/CentOS / Fedora) https://www.hivelocity.net/kb/how-do-i-install-suhosin-under-different-linux-distributions-rhelcentos-fedora/ https://www.hivelocity.net/kb/how-do-i-install-suhosin-under-different-linux-distributions-rhelcentos-fedora/#respond Wed, 30 Jan 2013 14:18:34 +0000 https://kb.hivelocity.net/?p=11093 Please refer the following steps : a.Download latest version of Suhosin # cd /opt # wget https://download.suhosin.org/suhosin-0.9.32.1.tgz Make sure that that php-devel is installed: # yum install php-devel b. Compile Suhosin under PHP and RHEL / CentOS Linux using the below commands # cd suhosin-0.9.32.1 # phpize #./configure # make # make install c. Configure …

How do I install Suhosin under different Linux Distributions? (RHEL/CentOS / Fedora) Read More »

The post How do I install Suhosin under different Linux Distributions? (RHEL/CentOS / Fedora) appeared first on Hivelocity Hosting.

]]>
Please refer the following steps :

a.Download latest version of Suhosin

# cd /opt

# wget https://download.suhosin.org/suhosin-0.9.32.1.tgz

Make sure that that php-devel is installed:

# yum install php-devel

b. Compile Suhosin under PHP and RHEL / CentOS Linux using the below commands

# cd suhosin-0.9.32.1

# phpize

#./configure

# make

# make install

c. Configure Suhosin on the server, using the below command.A configuration file of

Suhosin would be created

# echo ‘extension=suhosin.so’ > /etc/php.d/suhosin.ini

d. Restart apache

# service httpd restart

e. You can check if Suhosin has been installed on the server using the following:

php -v

The post How do I install Suhosin under different Linux Distributions? (RHEL/CentOS / Fedora) appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-do-i-install-suhosin-under-different-linux-distributions-rhelcentos-fedora/feed/ 0
How to Re-install Perl on a FreeBSD cPanel server? https://www.hivelocity.net/kb/how-to-re-install-perl-on-a-freebsd-cpanel-server/ https://www.hivelocity.net/kb/how-to-re-install-perl-on-a-freebsd-cpanel-server/#respond Wed, 30 Jan 2013 14:01:09 +0000 https://kb.hivelocity.net/?p=11025 Reinstall perl using the following command : [root@server:~]# cd /usr/ports/lang/perl5 [root@server:/usr/ports/lang/perl5]# make install clean Above commands could be used If easyapache, upcp or any other cPanel scripts are giving perl error while executing them on a FreeBSD server.

The post How to Re-install Perl on a FreeBSD cPanel server? appeared first on Hivelocity Hosting.

]]>
Reinstall perl using the following command :

[root@server:~]# cd /usr/ports/lang/perl5
[root@server:/usr/ports/lang/perl5]# make install clean

Above commands could be used If easyapache, upcp or any other

cPanel scripts are giving perl error while executing them on a

FreeBSD server.

The post How to Re-install Perl on a FreeBSD cPanel server? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-to-re-install-perl-on-a-freebsd-cpanel-server/feed/ 0
PHP as an Apache Module https://www.hivelocity.net/kb/php-as-an-apache-module/ https://www.hivelocity.net/kb/php-as-an-apache-module/#respond Wed, 30 Jan 2013 13:57:40 +0000 https://kb.hivelocity.net/?p=11009 When PHP runs as an Apache module, PHP files work under the Apache user/group known as “nobody”. For example, when a PHP file needs to write to another file or create/remove a file, it does so under the name “nobody”. In order to allow “nobody” to do this, you need to set specific permissions on …

PHP as an Apache Module Read More »

The post PHP as an Apache Module appeared first on Hivelocity Hosting.

]]>
When PHP runs as an Apache module, PHP files work under the Apache user/group known as “nobody”. For example, when a PHP file needs to write to another file or create/remove a file, it does so under the name “nobody”. In order to allow “nobody” to do this, you need to set specific permissions on the file/directory, such as 777 – which translates to read/write/execute by user/group/world. This is insecure because you have not only allowed the webserver (Apache) to read/write to the file, you have also allowed everyone else on the server to read/write to the file as well!

Due to the above conditions, when a PHP file creates or uploads a new file under your account, the new file will be owned by the user “nobody”. If you FTP into your account, all files owned by “nobody” will not be available for you to move, rename or delete. In this case the only way to remove the “nobody” owned files would be through a file on the server or to contact support and ask for the file ownership to be changed back to your username.

The post PHP as an Apache Module appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/php-as-an-apache-module/feed/ 0
How will you check and confirm that your server is using suPHP? https://www.hivelocity.net/kb/how-will-you-check-and-confirm-that-your-server-is-using-suphp/ https://www.hivelocity.net/kb/how-will-you-check-and-confirm-that-your-server-is-using-suphp/#respond Wed, 30 Jan 2013 13:56:52 +0000 https://kb.hivelocity.net/?p=11005 It’s very simple to verify this. Have a simple ‘php info’ script. Create a file named ‘phpinfo.php’ under the public_html of your domain Insert the following code: <?php phpinfo(); ?> Access the file in your browser using the link https://yourdomain.com/phpinfo.php At the top section search the line ‘Server API’. If you see’CGI’ then your account …

How will you check and confirm that your server is using suPHP? Read More »

The post How will you check and confirm that your server is using suPHP? appeared first on Hivelocity Hosting.

]]>
It’s very simple to verify this. Have a simple ‘php info’ script.

Create a file named ‘phpinfo.php’ under the public_html of your domain

Insert the following code:

<?php
phpinfo();
?>

Access the file in your browser using the link https://yourdomain.com/phpinfo.php

At the top section search the line ‘Server API’.
If you see’CGI’ then your account is hosted on a server with suPHP.
If it shows ‘apache’ then you are NOT on a suPHP server.

The post How will you check and confirm that your server is using suPHP? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-will-you-check-and-confirm-that-your-server-is-using-suphp/feed/ 0
How to disable php for a particular user on the server? https://www.hivelocity.net/kb/how-to-disable-php-for-a-particular-user-on-the-server/ https://www.hivelocity.net/kb/how-to-disable-php-for-a-particular-user-on-the-server/#respond Wed, 30 Jan 2013 13:53:20 +0000 https://kb.hivelocity.net/?p=10989 Put the following code in .htaaccess file for that user as: php_flag engine off OR In httpd.conf file,for that particular domain, put the following code in >directory> as <directory> php_admin_flag engine off </directory>

The post How to disable php for a particular user on the server? appeared first on Hivelocity Hosting.

]]>
Put the following code in .htaaccess file for that user as:
php_flag engine off

OR

In httpd.conf file,for that particular domain, put the following code in >directory> as

<directory>
php_admin_flag engine off
</directory>

The post How to disable php for a particular user on the server? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-to-disable-php-for-a-particular-user-on-the-server/feed/ 0
How to install Zend optimizer on your server? https://www.hivelocity.net/kb/how-to-install-zend-optimizer-on-your-server/ https://www.hivelocity.net/kb/how-to-install-zend-optimizer-on-your-server/#respond Wed, 30 Jan 2013 13:50:09 +0000 https://kb.hivelocity.net/?p=10977 Below are the steps: Create a file “phpinfo” in an account: <? phpinfo(); ?> and check it using a browser, you should see, you have Zend Optimizer installed.   If not, you can opt for /scripts/easyapache or   Download Zend Optimizer from https://www.zend.com/store/free_download.php?pid=13 and install it on your server. Steps to install: # tar -zxvf …

How to install Zend optimizer on your server? Read More »

The post How to install Zend optimizer on your server? appeared first on Hivelocity Hosting.

]]>
Below are the steps:

Create a file “phpinfo” in an account:

<? phpinfo(); ?>

and check it using a browser, you should see, you have Zend Optimizer installed.

 

If not, you can opt for /scripts/easyapache or

 

Download Zend Optimizer from https://www.zend.com/store/free_download.php?pid=13

and install it on your server.

Steps to install:
# tar -zxvf ZendOptimizer-2[1].1.0a-Linux_glibc21-i386.tar.gz
# cd ZendOptimizer-2.1.0a-Linux_glibc21-i386
# ./install.sh

The post How to install Zend optimizer on your server? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-to-install-zend-optimizer-on-your-server/feed/ 0
How can one combine PHP5 with PHP 4 ? https://www.hivelocity.net/kb/how-can-one-combine-php5-with-php-4/ https://www.hivelocity.net/kb/how-can-one-combine-php5-with-php-4/#respond Tue, 29 Jan 2013 14:21:33 +0000 https://kb.hivelocity.net/?p=10902 We have to compile php4 with apache and need to install php5 but do not compile it with apache. Normal configure commands could be used to compile php4 with apache. Now PHP5 Installation. a) You can download the version of pHP5 you would like to install from https://php.net/ REMOVE the “–with-apxs=/usr/local/apache/bin/apxs” from the line. We …

How can one combine PHP5 with PHP 4 ? Read More »

The post How can one combine PHP5 with PHP 4 ? appeared first on Hivelocity Hosting.

]]>
We have to compile php4 with apache and need to install php5 but do not compile it with apache.

Normal configure commands could be used to compile php4 with apache.

Now PHP5 Installation.
a) You can download the version of pHP5 you would like to install from https://php.net/

REMOVE the “–with-apxs=/usr/local/apache/bin/apxs” from the line. We are going to compile CGI version and it may broke the Apache!

b) Make sure you have the following prefixes and suffixes to install to the proper directories – otherwise currently installed php could be broken:
–prefix=/usr/local/php5 –exec-prefix=/usr/local/php5 –program-suffix=5

c) Add the necessary options for proper CGI redirects from Apache:
–enable-force-cgi-redirect –enable-discard-path

The result line will looks like this (please, do not use it – it has no CURL and PostgreSQL support – you better to follow steps below):

#./configure –prefix=/usr/local/php5 –exec-prefix=/usr/local/php5 –program-suffix=5 –with-xml –enable-bcmath –enable-calendar –enable-ftp –with-gd –enable-exif –with-jpeg-dir=/usr –with-png-dir=/usr –with-xpm-dir=/usr/X11R6 –with-imap –with-imap-ssl –with-kerberos –enable-mbstring –with-mbstring=all –enable-mbstr-enc-trans –with-mcrypt –with-mhash –enable-magic-quotes –with-mysql=/usr –with-openssl –enable-discard-path –with-pear –enable-sockets –enable-track-vars –with-ttf –with-freetype-dir=/usr –enable-versioning –with-zlib –with-pspell –with-gettext –enable-inline-optimization –disable-debug –enable-force-cgi-redirect –enable-discard-path

#make
#make install

#cp -f /usr/local/php5/bin/php5 /usr/local/cpanel/cgi-sys/php5
#ln -s /usr/local/Zend/etc/php.ini /usr/local/php5/lib/php.ini

It is recommended to add the following line to the php.ini at the bottom (it is a MUST if you compile php4 instead php5!). Note that this line will broke regular php4. As a common rule – if you are using the same php.ini, do not add this line:

cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode

Now we need to add several lines to Apache

#vi /usr/local/apache/conf/httpd.conf

Scroll down (better use the built-in search) to the “<IfModule mod_dir.c>”
There we should to add index.php5 after index.jp, but before index.php4. Result would looks like this:

<IfModule mod_dir.c>
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
</IfModule>

This to allow index.php5 as index file.

Continue editing. Find the “AddType application/x-httpd-php .phtml” and after it add this:

Action application/x-httpd-php5 “/cgi-sys/php5”
AddHandler application/x-httpd-php5 .php5

#service httpd configtest
#service httpd stop
#service httpd startssl

The post How can one combine PHP5 with PHP 4 ? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-can-one-combine-php5-with-php-4/feed/ 0
Php open_basedir Tweak https://www.hivelocity.net/kb/php-open_basedir-tweak/ https://www.hivelocity.net/kb/php-open_basedir-tweak/#respond Sat, 18 Dec 2010 06:41:22 +0000 https://kb.hivelocity.net/?p=2083 Php’s open_basedir protection prevents users from opening files outside of their home directory with php scripts. You can use this function to select which accounts cannot open files outside of their home directory when using php scripts. This is an important security feature as it will prevent users from being able to access system or …

Php open_basedir Tweak Read More »

The post Php open_basedir Tweak appeared first on Hivelocity Hosting.

]]>
Php’s open_basedir protection prevents users from opening files outside of their home directory with php scripts. You can use this function to select which accounts cannot open files outside of their home directory when using php scripts.

This is an important security feature as it will prevent users from being able to access system or other users files with php scripts. It will most importantly stop malicious scripts from being able to access a lot of important information.

  1. To access the Server Setup Menu, click on Server Setup, on the main screen of your WebHost Manager interface. Then, click on Tweak Security.
  2. Click on Configure in the Php’s open_basedir section.
  3. Click on the check box next to Enable php open_basedir Protection to enable Enable php open_basedir Protection.
  4. Click on a check box next to a domain’s name to allow them to open files outside of their home directory with php, if necessary.
  5. Click on Save.

The post Php open_basedir Tweak appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/php-open_basedir-tweak/feed/ 0