Putty Codes for servers - web-services

This is first time I'm working with Putty.very interesting
I want, how to install apache,php for new web-server via Putty.
rpm -qa | grep apache
rpm -qa | grep php
Those codes are how to find apache,php version for old web-server
i have some idea about those codes, But i don't know meaning of those codes
tar vxzf libssh2-1.4.2.tar.gz
cd libssh2-1.4.2
./configure
make
make install
Is this correct way to install apache,php for new web-server via Putty?

For the production servers installations YaST2 is better than putty.
because putty we have to includes codes and paths ,YaST2 is like normal windows software installation process.
We have to set path YaST2 then it works correctly.

Related

Is there a way to install memcached on windows server 2019? [duplicate]

While doing some web development, I needed to have Memcached (source code) installed on my local machine to closely simulate what was going on my server.
How to install Memcached on Windows?
Steps to install Memcached on Windows:
Download a stable version, in either 32-bit or 64-bit I have tested the 64-bit version.
Unzip it in some hard drive folder. For example C:\memcached
There will be memcached.exe file in the unzipped folder.
Open a command prompt (need to be opened as administrator).
Run c:\memcached\memcached.exe -d install
For start and stop run following command line
c:\memcached\memcached.exe -d start
c:\memcached\memcached.exe -d stop
As told in some previous comments the v1.4.4 is sometimes coming from a trusted source, sometimes not and it becomes hard to find. But there is now a very stable Windows native port for both 32 bits and 64 bits versions.
https://github.com/jefyt/memcached-windows
It's running well on our two PHP servers (PHP7 and PHP8).
Hope this helps.
Another Cygwin version is also available here and runs well too
https://github.com/nono303/memcached

Drupal 8 - Commerce Module - BC math PHP extension not found

I'm trying to install the commerce module in Drupal 8 however I get the error 'BC math PHP extension not found'.
I've searched for this problem and tried different things such as editing the PHP.ini by adding 'bcmath.scale=2' however I still get the error message.
Any help would be appreciated, thanks.
Just install bcmath plugin for your php version with no need to (re)build php as mentioned on accepted answer
# get php version
php -v
# install bcmath based on your version lets assume php 7.1
# for ubuntu
sudo apt install php7.1-bcmath
# for centos
yum install bcmath
# restart apache
sudo systemctl restart apache2
Above problem appears when installing commerce or commerce kickstart using composer
Update 2020
Please refer to #GiorgosK's answer for installing bcmath via a package manager if you are using a distribution that provides a bcmath package for PHP. I will ask the OP in comments to update the recommended answer, since that solution is probably what most people need.
Three years ago when I answered this question, I suggested that you have to rebuild PHP to get bcmath. That was incorrect. I was using an older distribution of Debian/Ubuntu that provided bcmath as a statically linked extension in the core php package. I determined at the time (incorrectly) that bcmath was a core extension that had to be enabled at build-time (like SPL and PCRE).
For those trying to troubleshoot a missing bcmath extension (such as those building/installing PHP themselves or nevertheless encountering issues), I've corrected and updated my original answer below. It explains in detail how to troubleshoot a missing PHP extension.
Original Answer (Corrected)
The error message indicates that PHP wasn't built with bcmath support or can't find the installed extension. PHP extensions are either built into PHP directly or they are loaded from an external dynamic library file at runtime.
Since PHP obviously doesn't have the extension built-in, it can't find the external library file that provides bcmath. This file on POSIX platforms will be called bcmath.so and php_bcmath.dll on Windows.
Extension files are installed under a directory indicated by the extension_dir property in php.ini. To determine the value of this property, run the following command:
php -r 'echo ini_get("extension_dir").PHP_EOL;'
The default value for this property is configured when PHP is built and may vary from distribution-to-distribution.
Once you verify the extension file is installed in this location, you can then check to see if the extension is enabled in php.ini. You should see a line that enables the extension like so:
# POSIX platforms
extension=bcmath.so
# Windows
extension=php_bcmath.dll
For Linux distributions like Ubuntu/Debian that install extensions via the package manager, the format is somewhat different since Debian employs a distributed configuration. Typically the package manager installs everything correctly, but you can check to see if an ini file exists for bcmath under the corresponding conf.d directory. These small ini files are snippets imported into the larger php.ini file, and they are typically symlinked to /etc/phpX/mods-available, allowing modules to be initially enabled for all PHP SAPIs such as CLI, CGI, Apache Mod PHP, ETC. Make sure a symlink exists for the PHP SAPI you need to use.
To ensure your PHP is loading the extension, run phpinfo(); in a test page and search for bcmath. You can also more easily do this with the CLI using a command like:
$ php -i | grep -i bcmath
# Success output: BCMath support => enabled
# (Another command that works well for checking extensions)
$ php -m | grep -i bcmath
# Success output: bcmath
In order for the CLI to show accurate results, it must target the same php.ini file. If it doesn't, then use the -c option to temporarily point the CLI at the correct php.ini (i.e. the one being used by your Drupal site).
Add BC MATH extension for PHP 7.2
If you are getting this (https://prnt.sc/sehmd5) error then, run below command using vagrant ssh
Run these command in root of vagrant ssh
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2-bcmath
service apache2 restart
Then open php.ini and search for bcmath
If bcmath scale is 0, Change it to 2
Restart php
Restart Apache
Hard Reload website
Install required modules
Similarly for any version of PHP, you only need to change PHP version in 3rd command.

Automating Software installation in Amazon Windows Instance

I would like to use Amazon Windows Instance to test the compatibility of the code which is developed on Mac. I may use the instance once a month for few hours for testing purposes that's it. I don't want my instance running the whole month and costing me.
Hence I am planning to create an instance whenever I want. To test the code I have to install g++, openGL, boost libraries etc. How can do this using scripts?
I am looking for some scripts which install packages on a freshly installed Windows instance, clone the files from git, build and test the software.
For example for AWS Ubuntu instance I can do the following,
./> ssh -i KeyPairForUbuntu.pem ubuntu#instance.eu-central-1.compute.amazonaws.com
./> sudo apt install <packages>
./> git clone pathToTheGit
./> run scons scripts to build and run the project
Is there any similar way to do this for Windows?
Please give any suggestions,
Thanks
try using https://chocolatey.org/
its a package management like apt-get for windows

VAGRANT SHARED FOLDERS DO NOT MOUNT - Windows 7 - Vagrant 1.7.4 - Ubuntu 12.04 precise64 - VirtualBox 5.0.10 with Guest Additions

I'm following the old tutorials off of gettingstartedwithdjango.com.
This series is quite old and I'm new to Django which is why I hit that site in the first place. It became my first introduction to Vagrant. Because the series is old and there are now new versions of Django, Vagrant, etc, I've found just getting through the first tutorial was quite difficult. This was mainly just the gap between Django v1.4 and the current version 1.9 which is what I'm running, including some syntax differences in settings.py and also some discrepancies between the text errata and the video which I had to sort through. It's a pretty detailed exercise if you're completely new to all of this (which I am), so it was quite challenging, and I was thrilled when after probably 12 hours of solid effort I was able to get everything working as was being described in the video but using all new versions of software. Once I got it all set up and working, I halted my Vagrant VM for the night and when I turned it back up (vagrant up) the next morning, I found that the VM would no longer mount its shared folders, essentially rendering the Vagrant VM useless to me as I'm then unable to run code which resides on the host machine (I'm running Windows 7) from within the VM (which is accomplished via the VirtualBox shared folders feature).
Not knowing what was wrong, this prompted me to completely reinstall my Vagrant VM. I was able to get things redeployed successfully with about one hour worth of effort, backtracking through steps I had taken to successfully complete the first tutorial in the first place, in order to back to the same point where I started (before I did the previous vagrant halt). When reinstalling the Vagrant VM I noticed messages that my VirtualBox Guest Additions (4.2.0) did not match the version of VirtualBox I have installed (5.0.10), which I recalled seeing the first time but ignored because it also said this isn't usually a problem and should work (if it weren't for bad luck, I'd have no luck at all). Since for me it didn't work, this led me down a whole rabbit hole of posts from various websites including SO, which ultimately had me updating my Vagrant VM, downloading/mounting/building/installing a new version of VirtualBox Guest Additions, and reloading my Vagrant VM only to wind up in the same boat. Shared folders were still not working!
To be very specific, this is more or less what I tried based on information from many websites:
cd /home/vagrant
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install dkms build-essential linux-headers-generic
sudo apt-get install linux-headers-3.2.0-23-generic
# mounted VBoxGuestAdditions_5.0.10.iso to Vagrant VM
cd /media/cdrom
sudo sh ./VBoxLinuxAdditions.run
sudo reboot
sudo /etc/init.d/vboxadd setup
sudo reload
c:\VAGRANT\vagrant plugin install vagrant-vbguest
c:\VAGRANT\vagrant reload
I was utterly convinced this was going to resolve the issue but it didn't.
Then I found this gem:
http://ddelizia.blogspot.com/2011/02/how-to-share-folder-on-virtual-box-with.html
This shows how to, from within the Vagrant VM, mount the shared folders back to your Windows 7 host. To be specific, here's what I did when I found things were working again:
cd /vagrant
ls -la
<this yielded nothing>
sudo mount.vboxsf vagrant /vagrant # see your VirtualBox Shared Folders settings
cd ~ # /home/vagrant
cd - # /vagrant
ls -la
# this yielded the expected folders from my Win7 host
In the mount.vboxsf command above, the first vagrant (without the /) came from the Name column in my VirtualBox shared folders settings. This is essentially an alias which is used to refer to the actual path on the Win7 host, in my case: C:/VAGRANT. The second vagrant (with the /) in that command is the /vagrant folder on the Vagrant VM (linux).
Given that I spent most of today messing with this and I figure there are plenty of people who are going to run into this same or related problem, I thought I would try to help out and save you all a bunch of time. Good luck.

Using Cygwin and Django

I'm starting to become less and less of a Windows guy and might try Linux.
Is difficult working with windows to do web development with the terminal.
I have two questions
How can I cd desktop on the Cygwin terminal I see people do this with ease but I keep getting
-bash: cd desktop no such file directory I'm guessing it has some thing to do with the fact that Cygwin is set up as the home directory.
I want to download https://www.djangoproject.com/download/1.4.2/tarball/ using wget
so I did
wget https://www.djangoproject.com/download/1.4.2/tarball/
and I get an error back saying
ERROR: the certificate of 'django' is not trusted.
ERROR: the certificate of 'django' hasn't got a known issuer.
for the first question:
check your current directory with pwd and navigate from there.
for the second question:
add --no-check-certificate to your wget command
wget -Odjango.tar.gz --no-check-certificate https://www.djangoproject.com/download/1.4.2/tarball/