How to set up Apache2 Server for PERL CGI & PHP programming with MySQL Server support on Linux/Ubuntu OS

0

Hello,everyone.Today,I want to share how we can set up Apache2  Server for PERL CGI and  PHP programming along with MySQL Server support on Linux/Ubuntu OS.

I am setting up Apache2 Server on Ubuntu 16.04.You can do the same on your system easily by following my steps.

Steps:

1.Install Apache2:
sudo apt install apache2

2.To start Apache2 server and test it (shown in screenshot):
sudo systemctl start apache2

To check status:
sudo systemctl status apache2

(Note: If you get any error in starting Apache2 then nginx  or other server maybe running on system, so you can stop nginx by using this command: sudo systemctl stop nginx ) and rerun the same command to start apache2.On my system, nginx starts automatically on reboot, so I have to stop it,otherwise apache2 server won’t start.

Screenshot from 2017-11-12 00-23-48.png

 

if you see output as “active (running)”,then apache2 server is running successfully.Now,if you access  http://localhost/  in your browser, then you will see Apache2 Default Page.

[Optional]
To stop Apache2 server:
sudo systemctl stop apache2
To restart Apache2 server:
sudo systemctl restart apache2

 

2.Install Perl if it is not installed.
sudo apt install perl

3.To enable CGI for Apache2:
sudo a2enmod cgi
sudo systemctl restart apache2

4. To write CGI files in /var/www/cgi-bin/ ,you need to use this command otherwise Apache2 will read CGI files from /usr/lib/cgi-bin/  :

sudo vi /etc/apache2/sites-available/000-default.conf

This will open vi editor and lines will begin like this and we need to add the 3rd line given below(shown in screenshot) , and then save the file:

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Add this 3rd line without editing other lines(you can ignore my other extra  lines  or use them if you want)
ScriptAlias /cgi-bin/ /var/www/cgi-bin/

Screenshot from 2017-11-12 00-59-54

 

5.Install MySQL if it is not installed (Remember MySQL password while installing as we need to use it later):
sudo apt-get install mysql-server

6.To run PERL programs which uses MySQL, you may need to install DBI & DBD:mysql for PERL by using these commands:
sudo cpan

Now cpan prompt will appear.Type these on prompt:
cpan>install DBI
capn>install DBD:mysql

Screenshot from 2017-11-06 16-59-12

7.To start MySQL server:
sudo systemctl start mysql
To check status of MySQL server:
sudo systemctl status mysql

Screenshot from 2017-11-12 00-40-22.png

if you see the output as “active (running)” , then MySQL server is running successfully.

 

7.To use PHP with Apache2:
sudo apt install php libapache2-mod-php
Screenshot from 2017-11-06 20-29-54

9.To enable PHP for apache2( change php7.0 with your version or just try ‘php’) :
sudo a2enmod php7.0

sudo systemctl restart apache2

# For PHP7.0
sudo apt install php7.0-mbstring

Screenshot from 2017-11-06 20-30-00

 

8.To enable PHP to connect with MySQL, use this command:
sudo apt install php-mysql

9.All the steps are complete now if all the previous steps are completed successfully .You need to place PERL CGI files in /var/www/cgi-bin/ directory so that you can access them in browser with URL http://localhost/cgi-bin/cgi.pl    .You need to write HTML and PHP files in /var/www/html directory so that you can acesss them in browser with URL http://localhost/index.html

Now, Apache2  Server  is set up successfully for PERL CGI and PHP programming along with MySQL support on the system

Thanks for reading the post.I hope this post has been helpful and easy to understand.If you have any question or you face any error,please post it in comments.

 

 

 

Advertisements

How to run and manage different versions of Python with virtual environment support by using pyenv

0

In this post,I am sharing how we can run different versions of python easily with virtual environment support  by usng pyenv .I am using pyenv these days.I find it better than using virtualenv .My currently activated environment remains activated even after restarting Terminal shell which I prefer.Another feature of pyenv  is that you can set environment local to any folder.

Thanks : Yamashita  (Author of pyenv )

Steps :

1.Use pyenv-installer   to install pyenv.You can install pyenv by using this command on Terminal :

$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

 

2.To update  pyenv ,use this command :

$ pyenv update

Screenshot from 2017-07-29 11-25-48.png

 

3.Open your .bashrc  file and make sure that these lines are added to it .Otherwise,you need to add these lines  to your .bashrc  file  by editing the file wih sudo command:

# Load pyenv automatically by adding
# the following to ~/.bash_profile:

export PATH=”/home/gaurav/.pyenv/bin:$PATH”
eval “$(pyenv init -)”
eval “$(pyenv virtualenv-init -)”

 

4. To install specific version of Python ,say Python 3.6.1 ,use this command :

$ pyenv install 3.6.1

 

5.To create a virtual environment system ,say  test which uses Python  3.6.1 which we installed in previous step,you can use this command :

$ pyenv virtualenv 3.6.1 test

 

6.To activate this new virtual environment test ,you need to use this command :

$ pyenv virtualenv 3.6.1 test

 

7.To list all virtual environments of pyenv ,use this command :

$ pyenv versions

 

7.To switch back to system Python ,use this command :

$ pyenv global system

 

Screenshot from 2017-07-29 11-29-28.png

 

8.To uninstall any virtual environment ,say test ,use this command and Entere when it asks for confirmation :

$ pyenv uninstall test

 

Now,you can easily run different versions of Python along with virtual environment support.

Thanks  for reading my post.I hope this post will be useful for them who  want to manage different versions of python with virtual environment support .If you have any query/question,please post in comments section.

 

 

 

How to decompile compiled .pyc python files to find/see original source code

0

Hello,everyone.In this post,i am sharing how to decompile compiled python files which are in .pyc formats usually.It may be useful for reverse enginering and if you want to know the original source code of any compiled python files.It may be also useful whenever  your original .py  python file is deleted unknowingly and there is only compiled .pyc file left  on disk and you want your original .py file back.In all those cases, this method can be used.

I have used Ubuntu OS here and it can be used on Windows OS also.

Tools Required :

uncompyle6  : https://github.com/rocky/python-uncompyle6/

Thanks :R. Bernstein (Author of uncompyle6)

Steps :

1.Install uncompyle6 by using pip on Terminal or you can download from above link and install it by running its setup.py file.To install uncompyle6 by using pip,use this command on Terminal :

pip install uncompyle6

 

2.After installation of  uncompyle6 ,you can check its successfull installation and its usage by running uncompyle6 command on Terminal (see screenshot).

 

3.To decompile any file in current diectory ,use command (see screenshot for example): uncompyle6 -o . <file-name.pc> 

Example : uncompyl6 -o . txfile.pyc rxfile.pyc

Screenshot from 2017-07-01 13-38-05

 

4.You will see your decompiled files created with same name in the current working directory(or desired directory) .Now,you can open this decompiled file with any Text Editor and see original source code.

Screenshot from 2017-07-01 13-38-46.png

 

5.if you want to see decompiled code on terminal(standard output),use command(see screenshot for example ): uncompyle6 <filename.pyc>

Screenshot from 2017-07-01 13-39-59.png

 

Thanks for reading my post.I hope this will be useful for python users who want to decompile compiled python files.

 

 

 

 

How to fix Realtek RTL8723BE Wireless Network Adapter Low Wi-Fi Signal Issue on Ubuntu/Linux OS

0

Hello,everyone.Today , I  want to share how to fix Realtek RTL8723BE Wireless Network Adapter Low Wi-Fi Signal Issue on Ubuntu/Linux OS.This tutorial can be also used for other Realtek Wireless Network Adapters supported by rtlwifi_new .

I have a great interest in using Using Ubuntu OS , so I installed latest version of Ubuntu OS alongside Windows OS.But, I faced low Wi-Fi signal issue on Ubuntu OS .Ubuntu OS failed to find many Wi-Fi networks which I could easily find & use on Windows OS.  Then,I started finding solutions to my problem and I found  a working solution.

Tools Required :

rtlwifi_new : https://github.com/lwfinger/rtlwifi_new

Steps :

1.Download rtlwifi_new from above link and extract it to Desktop (or to your desitrd folder).

2.Open Terminal and change your directory to the folder where you extracted rtlwifi_new zip file (here , Desktop/rtlwifi_new-master )  by using cd  command .See Screenshot given below :

cd   Desktop/rtlwifi_new-master 

3.Now,run this command in Terminal as shown in Screenshot given below:

make clean  (optional for first time installation,you can use it for further installation)

make 

Screenshot from 2017-06-18 12-17-22.png

 

4.After that ,run this command in terminal  as shown in screenshot given below:

sudo make install  

Screenshot from 2017-06-18 12-19-13.png

 

5.If everything is allright,you will see the message  ” Install rtlwifi SUCCESS  “  . It means that rtlwifi has beeen installed successfully.

6.Now,run this command as shown in screenshot given below :

sudo modprobe rtl8723be 

7.After that , run this command as shown in screenshot given below :

echo “options rtl8723be ant_sel=2” | sudo tee /etc/modprobe.d/rtl8723be.conf

8.This step is optional.If you want to see that  text contents are written successfully to /etc/modprobe.d/rtl8723be.conf .you can use this command  as shown in screenshot given below :

cat /etc/modprobe.d/rtl8723be.conf

Screenshot from 2017-06-18 12-27-53.png

 

9.If all the above commands ae executed successfully,then everything has been done. Now,you need to restart your computer and you will see Wi-Fi working properly and your computer will find available Wi-Fi   networks in your area.

10.After restarting  your computer, select Wi-Fi network which you want to connect .

Screenshot from 2017-06-18 12-35-14.png

 

I hope this post will be useful for many users who use Realtek Wireless Network Adapter  and face low Wi-Fi signal issues on Ubuntu OS.

If you have any query or you face any problem ,please comment.Thank you for reading my post.

Thankslwfinger ( Author of rtlwifi_new)

Sources:

1.  https://askubuntu.com/questions/645220/unable-to-connect-wifi-ubuntu-14-04-lts-hp-pavilion-network-driver-rtl8723be/729660#729660  

2. https://askubuntu.com/questions/635625/how-do-i-get-a-realtek-rtl8723be-wireless-card-to-work/635629#635629

3. https://connectwww.com/how-to-solve-realtek-rtl8723be-weak-wifi-signal-problem-in-ubuntu/4625/

 

 

 

Using Python3 and Python2 on Windows OS with pip support

6

Hello everyone.Today,I am going to share how to use Python3 and Python2 with pip support  on Windows OS.If you try to install latest Python version 3.6 ,it provides you the option of adding Python 3.6 to PATH ,but this is not provided by Python2 installer still.Many users may find it difficult to use both version with corresponding pip on Windows OS.

So,I am sharing this method which helped me to use Python2 and Python3 simultaneously.

STEPS :

1.Download Python3 and Python2 installer from python.org .

2.Run Python3 installer and tick(enable) “Add Python 3.6 to Path” as shown in screenshot so that you can run Python3 by python command on Terminal/Shell.

p3s

 

3.You can run Python3 by using python command and its pip by using pip command.

4.Run Python2 installer and install Python2 .

5.Now ,you need to edit system environment  variable PATH as shown in screenshot below  for using Python2  and its pip2 in Terminal/shell :

path_setup

 

6.Click on Edit Button .After that all the enteries of  PATH  variable will be displayed.Now,click on New Button and add this entry as shown in screenshot:

C:\Python27\Scripts

path_edit.JPG

 

7.Click on OK button to save and make it sure that the entry added to PATH varaiable is not C:\Python27  . Otherwise , python command will run Python2 instead of Python3 .

8. Again add a new entery PY_PATH to system variables and set its value to 2 if you want to run python2 by using py command.

9.Now, you can use Python 3 by using python or py -3 . You can use pip for python 3 by pip or pip3 command .You can use Python2 by using py command or py-2 command .You can use pip for Python2 by using pip2 command.(See Screenshot)

pipnnn.JPG

 

If every step is followed correctly,you will see Python3 and Python2 running successfully with pip support in Terminal.

If you have any query or you need help,post in comments.I will be glad to help you.

Thanks for reading my post.I hope my post will be useful to Python users who are using Windows OS.

 

 

 

Bitly v1.00.0 pys60 app for Symbian S60 by gauravssnl based on bitly_python API

6

Bitly v1.00.0 pys60 app by gauravssnl based on bitly python API

Geneate bit.ly short URL of any long URL easily and exapand bit.ly URL to get original link.

Bit.ly URLs are used for sharing links on social networking sites and on blogs to make long URLs shorter.

Download link : Bitly app v1.00.0 by gauravssnl.zip

Screenshot :

ss

 

Features :

-Generate bit.ly link

-Expand bit.ly link

Steps :

1. Register an account on bitly.com by visiting this link : https://bitly.com/a/sign_up

2.After that ,you need to get your bitly Access Token of your account

3.Now open Bitly app , and enter your Access Token in Settings from menu.

4.Now,click on Connect .If your Access Token is correct, you will be successfully logged in and your users details will be displayed. If this does not occur, check your Access Token and try again.

5.Now,you can generate bit.ly short URLs and expand bit.ly URLS to get original links

Thanks : Jehiah Czebotar (bitly_ api author)

Thanks everyone.

Py Pastebin v1.00.2 PyS60 App for Symbian S60 by gauravssnl

0

Py Pastebin v1.00.02 pys60 2.0 app by gauravssnl for Symbian S60 OS

DownloadPy Pastebin v1.00.2 by gauravssnl.zip

This app is for creating new pastes directly from files on pastebin.com

There is no need to open pastebin website and copy & paste your codes.
Pastebin is very famous code sharing website.
I hope this app will be useful for symbian s60 users.

Screenshots :


How to use :
1.You must have an account on pastebin.com
If you do not have an account,you can create a new account .
2.Log /Sign into your account
3.Get your own unique API key by visiting this URL :
pastebin.com/api

4.Now open app Py Pastebin and click on Login Settings.Fill your API Key,username ,passwords.

15241737_1308228179233198_3312973459983355607_n

5.Click on ‘Login’ and wait for successful login.If you are not able to login after several tries ,that means your API key is invalid.Verify your API key.
6.After successful login,you can select a file for creating paste.If paste is succesffully created,that paste URL will be shown.

Thanks everyone.