The post Install PHP (with extensions) on MacOS using Homebrew appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>This article has detailed steps on doing clean install of PHP 7.2 (latest PHP version as of August 2018). If you already have PHP installed via homebrew, then it requires you to first remove those PHP installations and then do the fresh PHP install. Reason of doing so, is to avoid conflicts that arise because of Homebrew March 2018 updates. Further details within blog!
Recently, I wanted to include a new module (visualception) in my test automation project that is built on top of codeception. In order to successfully make it work, there was a requirement to have php-imagick
extension already installed in your system.
Initial search showed that, in past you could have installed php-imagick
extension using command like brew install php71-imagick
, but this does not work any more of Homebrew updates. With the migration to Homebrew-core
, the php formula has stopped taking over the role of PECL. So now for installation of php extensions (like imagick or x-debug) you have to use PECL.
Due to older php installations, I was getting lot of issues while trying to install php-imagick extension. Ultimately, I was able to resolve all the problems by installing PHP from scratch. In below, I have listed all the steps for fresh PHP installation.
1.1 First install xcode-command-line tools by running below command in terminal. If any popup message appears during installation, that needs to be confirmed. For further details on xcode tools, you may check this link.
xcode-select --install
1.2 As we are going to do all PHP related installations through macOS package manager Homebrew. So next we need to set it up by running below command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installation process will will show several prompts and may also ask for mac password. This may take a few minutes. Once it is done, you can verify the installation was successful by running below commands:
brew --version # it will return the Homebrew installed version number like .. Homebrew 1.7.2 brew doctor # it will ensure everything is configured correctly and if something is wrong then give instructions to fix
2.1 Removing all PHP-Homebrew related installations
First run below brew commands to make sure brew is updated and has no configuration issues.
brew update # updates brew itself brew upgrade # upgrades all packages installed via brew brew cleanup # by default, brew doesnot uninstall old versions. cleanup command will do the job brew doctor # Checks brew state and returns error, if there are any issues
If brew doctor or cleanup throws any errors then fix them as per instructions returned by brew-doctor or ask google
Now onto removing existing PHP-related installations (that were done by homebrew).
brew list | grep php # will show list of existing php installations done via homebrew brew uninstall --force $x # where $x = value returned by above command (brew list | grep php) rm -rf /usr/local/Cellar/php # run to ensure php dir removed rm ~/Library/LaunchAgents/homebrew.mxcl.php* # run to remove launch agents sudo rm /Library/LaunchDaemons/homebrew.mxcl.php* ps ax | grep php # checks php processes, if any still running then reboot
After above, again run brew cleanup
and brew doctor
to ensure everything working fine.
3.1 Run PHP Installation commands
brew install php # this command will install latest available version of php Or if you want to install specific versions you may run commands like below brew install [email protected] # these are version specific commands. run these if specific version required. brew install [email protected] brew install [email protected] brew install [email protected] hash -r # update bash's internal paths
Once done with above, now verify thatyou are running the correct homebrew–PHP by running type php
command. If it returns /usr/local/...anything.../php
then it means you are running homebrew-PHP. If it returns something like /usr/bin/php
then it means you are running apple-supplied-PHP. In that case you need to fix paths, as we want to use homebrew-PHP! Finally run brew doctor
to make sure everything is fine and no configuration errors are thrown.
3.2 Switching between PHP versions
If you have multiple php versions and want to switch between them, then you can do so by using brew link
and brew unlink
commands.
# Running below commands will switch php5.6 from php7.2 brew unlink [email protected] brew link --force --overwrite [email protected] brew doctor # to ensure all configs are fine php -v # verify successful relinking done # To again switch to php7.2 from php5.6 do below commands brew unlink [email protected] brew link --force --overwrite [email protected] brew doctor # to ensure all configs are fine php -v # to verify successful relinking done
3.3 Install PHP extensions
As mentioned in start, php extensions such as php-imagick or php-xdebug which were previously installed by commands like (brew install php53-imagick
) now should be installed by PECL (for details on PECL check this link). Below are example commands for installation of xdebug and imagick extension.
pecl install xdebug pecl install imagick
Now you may run php -v
to verify php version and php -m
to check enabled extensions.
The post Install PHP (with extensions) on MacOS using Homebrew appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>The post 2 Easy ways to set Environment variables in Linux appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>In this blog, I will take you through the steps to set environment variables in Linux (and its flavours like Fedora). If you are looking to set environment variables in windows then visit my other blog ‘3 Easy steps to set Environment variables in Windows’. Coming back to Linux, I will use the following examples in this tutorial:
1. JAVA_HOME and JAVA Path variables (Java)
2. CATALINA_HOME (Apache Tomcat)
Before moving on to actual steps, you should know that in Linux you have option to either set environment variables permanently or for a single session. Similarly, you also have the option to set environment variables for single user or all users. Let us start from steps to set environment variables for a single session. Let’s start with most easiest but temporary way of setting these variables.
1- Temporarily set environment variables in Linux:
Setting up environment variables for single session is very easy and if you are in a scenario where you will not need to use it again then it is best choice for you. You may also use this approach if you frequently need to test in different environments using different versions of processes.
To add Java home and path variable run following commands in linux terminal:
export JAVA_HOME=/root/java/jdk-xyz export PATH=$PATH: /root/java/jdk-xyz/bin
Replace /root/java/jdk-xyz and /root/java/jdk-xyz/bin by path of JDK root and bin directory paths. You can find these paths by ‘whereis’ command or through GUI if you are using Fedora etc.
Similarly, to add Tomcat CATALINA_HOME variable, run following command on Terminal:
export CATALINA_HOME=/root/tomcat
Where ‘/root/tomcat’ is the path of apache tomcat directory in your system.
2– Permanently set environment variables in Linux:
To set environment variables permanently, we need to put commands in system files. It means that whenever Linux OS will start, these commands will be automatically executed. We can use this approach to add permanent variables for single user or all users.
For Single user:
To add permanent variables for a single user, we will need to make changes to profile file of the user. Path to this file is ‘/etc/profile’
If we have a GUI (like fedora), then we can simply navigate to this path under system files and edit it. Alternatively, we can access file by using following command in terminal…
vi /etc/profile
Once we are inside the file, we can put ‘export commands’ at end of file to add required variables. After that we can save and exit.
export JAVA_HOME=/root/java/jdk-xyz export CATALINA_HOME =/root/tomcat-xyz export PATH=$PATH:/root/java/jdk-xyz/bin
To activate new changes, we can either logout-login or run following command in terminal:
source /etc/profile
For ALL users:
To add permanent variables for all users, we will need to make changes to bashrc file which is located at ‘/etc/bashrc’
If we have a GUI, then we can simply navigate to this path under system files and edit the file. Alternatively, we can access file by using following command in terminal…
vi /etc/bashrc
Once we are inside the file, we can put export commands at end of file to add required variables. After that we can save and exit.
export JAVA_HOME=/root/java/jdk-xyz export CATALINA_HOME =/root/tomcat-xyz export PATH=$PATH:/root/java/jdk-xyz/bin
To activate new changes, we can either logout-login or run following command in terminal:
source /etc/bashrc
Verify successful addition of environment variables:
To verify new variables, you may run following commands in Linux terminal:
set echo $PATH echo $CATALINA_HOME echo $JAVA_HOME java –version
Found this blog useful? or still having issues in setting up environment variables? Feel free ask in comments. I will be pleased to help : )
The post 2 Easy ways to set Environment variables in Linux appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>The post Introduction to Apache Tomcat for Dummies appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>Following are some of the key points that you should know about Apache Tomcat server…
Difference between Apache HTTP and Apache Tomcat:
Apache is the name of organization that developed both Apache HTTP and Apache Tomcat. Even though these are two different tools but in real time scenarios they are often used together as they compliment each other. Following are some key points that differentiate them from each other.
Apache HTTP | Apache Tomcat |
---|---|
Apache HTTP is primarily a web server written in C | Apache Tomcat is primarily a servlet and JSP container based on Java |
Apache HTTP server is good for serving static content but it can also serve dynamic content if used with add-ons | Apache Tomcat is good for hosting servlets and JSPs but it can also host static content (though it is not preferable) |
Apache HTTP is used mostly where we have to run PHP, Perl application and CGI scripts | Apache Tomcat is used where we have to run servlets and JSPs (as they are not supported by Apache HTTP) |
Benefits of Apache Tomcat from Testing perspective:
As Tomcat can be used as a standalone PC application, therefore it can be really helpful in testing tasks where we can turn local machine into a server by Tomcat and execute any testing task.
You can find further instructions to download, install and configure Tomcat on Tomcat official page. Do try it and share your experience and feedback with us!
The post Introduction to Apache Tomcat for Dummies appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>The post Guide to Configure NetBeans IDE for C++ appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>1-Download the suitable version NetBeans IDE from NetBeans Download Page. You can either choose the Full version containing all components or the CPP version with components required for C/C++.
2- Install the NetBeans. It is quite simple and straight forward process to do it. If you face any difficulty let me know in comments or consult the NetBeans on site guide.
3- After the NetBeans is successfully installed, open it and check if c++ is already integrated or not.
You can check it by going to menu >>> File > New Project > and see if c++ directory is displaying or not. If it is displaying, then it means that C++ is integrated and you can move to step-5. Otherwise follow the process in step-4
4- If directory is not displaying, then it means that we need to install plugin for c++
We can do it by going to menu >>> Tools > Plugins > Available Plugins > C++
Select it and Install (Select download server of your choice and accept to agreement)
After the Plugin has been installed, restart the IDE.
5- On this stage, you can try to create a new c++ project to verify if everything is ready. While doing so you might get the following error message..
Build host is not connected. Compiler is not set for NetBeans c++.
If you observe this message, then it means that c++ compilers and tools are missing from your system and you need to install them to work with c++ projects. For installing compilers we have options to either install Cygwin or MinGW. I found that MinGW is easier to proceed so I decided to go with it. Following are the steps to install and configure MinGW…
a) Download the MinGW exe. I used following Softpedia link to download MinGw.
Once downloaded, Run the MinGW installer and choose to install the required components. I selected all of them (except MinGW make, as we will be using make from MSYS, as instructed in NetBeans official guide. We will download and configure it in later steps.). This installation process can take some time depending on net connection as some components will be downloaded during installation. After the installation has been completed add the MinGW directory to Windows Environment variables “path”.
It can be done by following these steps…
Windows> Start > Settings> Control panel> Settings > Advanced > Environment Variables.. Edit already present "path" in the list, and enter compiler directory path after a semi column ; like this.. ;C:\MinGW\bin Click OK.
If you still face any issues in setting up enviornment variables then visit my detailed blog on ‘How to setup windows environment variables’.
b) Next you need to download and install MSYS exe and run it.
To avoid any issues and conflicts, it is preferable to choose MinGW directory as the destination installation directory for MSYS.
c) After MSYS installation, next we need to install gdb Debugger. Visit this download gdb Debugger link to download it.
After all these installations are finished, restart NetBeans IDE.
Now to very ending steps:
Go to TOOLS > OPTIONS > C++ > BUILD HOST>> Press ADD button to add build host.. Browse to C:\MinGW\bin in Base Directory. Select MinGW in Tool Collection family and Tool collection Name.. (or they will automatically get selected) mingw-netbeans-add (1) Press OK.
After going through all these steps, you are ready to work with NetBeans IDE for C++. If you have any confusion in above steps or face any other issue then feel free to ask in comments.
The post Guide to Configure NetBeans IDE for C++ appeared first on Software QA, Functional, Automation & Load Testing with Arif.
]]>