29 Nov 2014

Enable WordPress Permalinks on Windows IIS

WordPress is written in PHP, and generally php runs better under apache on Linux, but you can run it on IIS on Windows machines. In fact this blog is running under Windows.*

If you find you have changed the permalinks options in your wordpress installation, but you find they don’t work,  first check if you are running on a Windows machine. On a shared hosting account, it should have said whether it was windows or linux, but at the least, if you have the option for asp.net, then you are on windows.

If you are on a Linux machine under apache, there are loads of resources for making sure permalink rewrites work. Running WordPress on windows however is much less common, so I thought I would post a quick fix for getting it to run under IIS7.

The trick involves adding a web.config file to your base installation. A web.config file is a configuration file used by Windows specifically for .net, but in this case if you are running wordpress you can trick IIS into passing the buck on files it can’t find to WordPress, that then handles it.

Simply ensure the URL Rewrite module is enabled on the IIS server (lots of hosts, including GoDaddy, have this enabled, but talk to your hosting company if it doesn’t), then add the following web.config file to the base of your WordPress installation.

Solution

Step: 01
>Open up a text editor and create a new file
>Copy/paste in the code that follows(code 1 or code 2) into your new text file.
>Save the file as web.config
>Upload the file to the root of your WordPress installation

Step: 02
>Log into your WordPress install  Dashboard –> Settings –> Permalinks and set it to Post name and click Save Changes.

You should now have Pretty Permalinks on a Windows server!

Code 1

<rewrite>
 <rules>
 <rule name="Main Rule" stopProcessing="true">
 <match url=".*" />
 <conditions logicalGrouping="MatchAll">
 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
 </conditions>
 <action type="Rewrite" url="index.php" />
 </rule>
 </rules>

</rewrite>


Code 2

<?xml version="1.0"?>

<configuration>

  <system.webServer>

    <rewrite>

      <rules>

        <rule name="Main Rule" stopProcessing="true">

          <match url=".*" />

          <conditions logicalGrouping="MatchAll">

            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

          </conditions>

          <action type="Rewrite" url="index.php" />

        </rule>

      </rules>

    </rewrite>

  </system.webServer>


</configuration>

29 Oct 2014

What is short open tag in php

<?= is not equal with <?php.

<?= is the short open tag for <?php echo

<? is the short open Tag for <?php

You can use short open tags by activate short_open_tag in the php.ini.


How to Enable "short open Tag":


Method 01
Go to php.ini and set short_open_tag = On

and then finally restart your server


Method 02

You should be able to change it in your .htaccess file if it wasn't locked down

<IfModule mod_php5.c>
   php_value short_open_tag 1
 </IfModule>

25 Oct 2014

How to change PrestaShop admin Password using Database

Step :01
Go to the PrestaShop root folder and find the config folder. This will take you to a list of all files within that folder.select-config-folder

Step :02

Look for the settings.inc.php file.

Step :03
Once inside the settings.inc.php file, locate the setting named _COOKIE_KEY and copy the string value. You may want to save it temporarily to a word processing document such as notepad.

Step :04
Go to the database and select the one named ps_employee.
Note that your PrestaShop database prefix might not begin with ps_

Step :05

This opens the table data information. Find your admin user from the list of data rows.

Step :06
Find the password row, it is named passwd. There are two columns you will need to edit. The first is the Function column. Use the dropdown and select the MD5 option. The second column is the Value column. For this column, paste the _COOKIE_KEY value you saved earlier and attach your new password directly to the end of the key with no spaces. Be sure to use a real password and not anything easy like NEWPASS1234 that we used in the example.


Step :07

Then click the GO button to save the new information.

Now login the admin panel.

How To Install WordPress Plugin Without Using FTP

You are not able to update/upgrade your WordPress and plugins to a newer version without providing your FTP connection information. This is a common issue whereby the WordPress system can’t write to your /wp-content folder directly.

To solve this issue you need to define the FTP details in your wp-config.php file so WordPress will remember it. Alternatively, you may also provide WordPress with write access to your /wp-content folder by accessing the FTP root file and changing the folder file permission (CHMOD) to 775 rather than the default 755 and 644.

There is however an easier way to deal with this; by defining constant, FS_METHOD in your wp-config.php file. This bypasses WordPress’s recurring prompts, and allows auto-updates of your files to happen. And it takes only 1 line of code to do this.

Step 1. Open /Wp-Config.Php

Now the first thing you need to do is to open the wp-config.php file from your WordPress root folder (you may access this file from your WordPress installer folder). From the installation folder, the file is located at wordpress/wp-config.php

Step 2. Insert FS_METHOD

Paste the following code to your wp-config.php file, preferably just below every other line of code.

define('FS_METHOD','direct');

Step 3. Save And Upload

When you have already pasted the one-line code, you can proceed to upload the file to your WordPress root folder on your server, and it should work right away. Uploading can be done directly from your host control panel.

24 Oct 2014

How to check php version in website

Creating a PHP info page in Website


Using the steps below I'll show you how to create a PHP info page that will allow you to not only see your PHP version, but also all the PHP options that are currently in use.

Step :01

Login to your cPanel.

Step :02
Under the Files section, click on File Manager, then select Web Root and click on Go.

Step :03
At the top-left, click on + New File, name the file info.php and click on Create New File.

Step :04
Now open the file with the Code Editor in cPanel and enter in the following code:
<?php
phpinfo();
?>

Then click on Save Changes at the top-right hand corner of the screen.

Step :05
Now if you visit your website such as http://example.com/info.php you should see the PHP info page. This example screen shot shows that this server is running PHP version 5.2.17, and that the PHP configurations are getting loaded from the file /home/userna5/public_html/php.ini


php info page

Step :06
You can scroll further down the PHP info page, to also see individual PHP options that you can set.