Tuesday, March 29, 2016

How disable the “Help” Menu in Joomla administrator

The default installation of Joomla comes with a "Help" menu. It has the links to important Joomla resources. We were using Joomla as a cms for one of the web tool we were developing for our client. In that tool, there were three levels of users were there. 
             1. User 
             2. Manager 
             3. Administrator.

Though the help menu holds links to important Joomla resources, they can also be an unnecessary distraction. Hence we wanted to disable the Help menu in all the three users. So this can be achieved by following the below steps:

1. Login to Joomla as a administrator.
2. Open Module Manager under Extentions

   

3. In the Modules, first change the filter to show Administrator modules instead of Site modules

   



4. Now look for Admin menu module

  

5. Select this Admin menu module and click on Advanced tab

     
6. Go to Help menu option

   

7. Instead of Show option click on Hide button

      

8. Now click on Save and close option on top.

9. Now you can see that Help menu is disabled fro the main menu.

      


That's it. Happy coding.





Saturday, March 26, 2016

How to access IIS hosted site from another PC

I was working on a Intranet project for one of my client. Earlier It had to be developed with Apache web server. But later they wanted it to be developed with IIS (Internet Information Service) server. So we wanted the site i.e web application to be accessed by other PCs on the local network which's hosted on IIS Server.

To achieve this you need to follow the below steps:

1. First you should know the port on which your site can be accessed. For example it's 6060 in my case. You can get it through the web matrix or IIS manager. Looks as below in the web matrix:




First we need to open this port for the public access using the windows firewall.
      1. Open the Control Panel
      2. Open the Windows firewall
      3. Click on Advanced Settings
       

      4. Select Inbound rules.

         

      5.  Select New Rule:

            



       6. Select the Port

                 

     7. Select TCP and enter the port number. In my case it's 6060

               

         8.  Check Allow connections and click on Next button

            

        9. Select the profile as all the three, public, private and domain as shown below:

           

        10. Now save it with a Name. That's it for opening a port.

2.  Now we need to do some settings in the IIS. Go to IIS Express installation folder. Select config directory.



3. Now open the applicationhost.config file for edit.
4. Search for bindings and enter the below line as shown:

   <binding protocol="http" bindingInformation="*:6060:*" />
                </bindings>


5. Stop the Site through IIS or Webmatrix and save this file.
6. Now open the command prompt with the admin permission (Right click on command prompt and run as administrator)
7. Run the below command in he command prompt as shown:

                       netsh http add urlacl url=http://*:6060/ user=Everyone
You can change the port to match yours. Mine is 6060 hence I mentioned as 6060.


8. Now restart the IIS server and try to access the intranet application with the other PC with the below URL

http://<IP Address of he Server>:PORT 

That's it. Happy Coding.











Friday, March 18, 2016

How to export a mysql database using Command Prompt

Some how my PhpmyAdmin stopped working And I had to take up a back up of one of my databases. So that time,  I thought of using the Mysql Command prompt service. 

To take the back up, we can export the tables and contents of the database using mysqldump.  Please note that mysqldump is not a command from mysql. It's a utility provided by MySql to export the contents. So it does not work from the mysql command. If you use it in mysql prompt you get the below error:


So you need to go to the place where my sql is installed and can see mysqldump.exe


Now go to this place using the command prompt and execute the below command:

mysqldump -u root -p mrms >mrms.sql

Here mrms is name of the database. It prompts for the root password. Enter the root password and then the mrms.sql is generated in that directory.

 

That's it. Happy Coding.

Sunday, March 13, 2016

PHP And MySQL configuration with IIS Server

This blog describes the installation and Configuration of PHP, MYSQL and IIS (Internet Information Services) server for running the web applications.

IIS Installation:

Internet Information Services is a web server from Microsoft. Recently they are supporting to host PHP and MySql applications also.  Here we cannot install all together in a single package as WAMP. We discussed the installation of wamp in one of my previous blogs: Installing the Wamp Server
Here, with IIS we need to install each separately and configure to work together.

IIS is supported in Windows 7 (Professional & Ultimate Editions) Windows Vista (Business & Ultimate Editions) and above. It comes by default with Windows 7.  Please Note: IIS is not supported in Starter, Home Basic, Home Premium Editions.

STEPS TO CHECK WHETHER IIS IS ALREADY INSTALLED IN YOUR COMPUTER:


To Install IIS:

Step 1: 


Step 2: 




Step 3: 


Step 4: 


Step 5: 


Step 6:


Step 7:


If you want you can install later versions of IIS also. (8 or 8.5).  To install all the required packages you can use Windows wpilauncher.exe 

MySql Installation

There are a couple options for installing MySQL on Windows. It can be downloaded as ZIP file, unzipped into the directory of your choice and run via the command line or you can install it as a Windows service with all the bells and whistles. I personally like to run it as a service and let Windows manage things. Whatever option you choose, all the downloads are available from http://dev.mysql.com/downloads/mysql/

I chose the MySQL Installer 5.6 for Windows which installs everything. The installer is 32-bit but installs either the 32-bit or 64-bit version of MySQL depending on your system. There’s also the option to choose a small file that will perform a web installation or the large file if you’re not certain you’ll have a connection available.

I chose the Custom setup type from the first option screen so I could choose which components I wanted on the machine. For this use, the server itself, MySQL Workbench and Notifier, which alerts the user to any change in the server’s status, was enough. I didn’t specifically need Workbench for a joomla installation but it doesn’t take up much room and might come in handy at some point. 



If you’re installing MySQL Workbench, you might need to install the Microsoft  Visual C++ 2013 Runtime in order to complete the installation. The Installer will notify you of this or any other failing requirements and give you the chance to fix them without stopping the installation routine.



The rest of the Installation wizard screens are pretty well self-explanatory. Under Type and Networking, I chose Server Machine since this would actually be a web server and I went with the standard system account for the Windows service screen.

After the installation finishes, it will offer to open MySQL Workbench where you can ensure that you’re able to login to your new database server. Another option is to open the MySQL 5.6 Command Line Prompt from the Start menu and type in the password that you set for the MySQL root account.


You can create the required database using the commands mentioned in MySql User Manual. 

PHP Installation

You can download the Windows PHP files from http://windows.php.net/download  or http://windows.php.net/download#php-7.0 . The non-thread safe edition is required when working with IIS . 
You can download and install the latest PHP version.  I used version 7.0
After you’ve downloaded the PHP files, unzip the package to the directory of your choice on your hard drive. I chose c:\php to keep things simple. 

The package includes a php.ini-production file which you will need to rename as php.ini and copy to your c:\windows directory after making a few changes. This file holds keys and settings, many of which are commented out and can be uncommented to apply specific settings as needed.
In your favorite text editor, uncomment the following keys in php.ini by removing the semi-colon from the beginning of the line and change the settings as follows:

cgi.force_redirect = 0   (around line 753)
fastcgi.impersonate = 1 (around line 780)
Set extension_dir to the ‘ext’ folder in the path where you stored the PHP fies (i.e. ‘C:\PHPext\’). (around 736)
date.timezone should be set to the time zone of your server (around line 926)
The last setting is a string value (without quotes around it, i.e. America/New_York). You can find a list of appropriate values at http://php.net/manual/en/timezones.php.

In order for PHP to function with MySQL, you will also  need to uncomment the following lines in the Windows Extensions section.

extension=php_curl.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

The php_curl.dll extension is to enable WordPress to retrieve and display product news updates. Without it, you’ll see an error message on your desktop every time you log in.

Also you can directly install this with the windows launcher attached above.

Coniguring PHP and MySql with IIS

After you’ve setup PHP, you’ll need to configure IIS to work with PHP.
First verify that the machine has been assigned the role of a web server and that CGI is installed as a service under IIS. On Windows Server, You can do this by opening the Server Manager (not the IIS Manager) and selecting Web Server (IIS) under Roles.  If this option does not exist, right-click on Roles under the Server Manager tree and add it. If Roles option is not found, you can check directly CGI option is selected. 

You need to set
Request path: *.php
Module: FastCGIModule
Executable: (path to your php-cgi.exe file)
Name: PHP

Now you are all set to run PHP, MYSQL applications through IIS. Need to restart the IIS And now create a php file and add the below code:

<?php phpinfo(); ?>

This is a basic PHP command that tells the browser to display all PHP settings. Name the file phpinfo.php and store it in your wwwroot directory. When you enter http://localhost/phpinfo.php in your web browser, IIS should return the PHP settings page. You’ll need to scroll down or search the page to ensure that it has a section for MySQL as shown in the image below.


Installing Joomla

Now you need to install Joomla content management system to run web applications. You can run the attached Joomla.exe

This installs the joomla and webmatrix. Now open the webmatric and open this joomla site in the explorer. 



Now change the settings through configuration.php file present in this directory.  Need to update the correct user name and password. Save this file. Now in the Microsoft Web Matrix, find the port for this site as below:


Click on the site :

 

Note down the port number and now restart the iis and check with the mentioned URL. Installed Joomla website should run.

Now you need to open this port from the windows firewall to access from the other ip addresses.
Firewall needs to be configured to accept incoming calls on TCP Port 80.
1. Go to windows firewall with advance security
2. Inbound Rules -> Action -> New Rule
3. Select Predefined radio button and then select the last item - World Wide Web Services(Http)
4. Click next and leave the next steps as they are (allow the connection)

Now you can access the site with the below url:
http://< ipaddress of the server>:port

That's it Happy Coding.