How to increase wp memory limit and PHP Max Input Vars in wordpress

Increasing memory allocated to PHP:

 

Just add this line into wp-config.php file:

1
define( 'WP_MEMORY_LIMIT', '64M' );

Add this code into htaccess file:

1
php_value memory_limit 128M

max_input_vars

The most common issue stems from the

1
max_input_vars

PHP directive, which was introduced in PHP 5.3.9. By default, max_input_vars is set to 1000, which can easily be reached with the WordPress menu system, since each menu item sends about 12 variables per item.

Solution

The solution is to simply configure the

1
max_input_vars

so that it is large enough to handle the number of variables being sent by WordPress to save your menu.

php.ini

If you have access to your

1
php.ini

, you can just add this directive (or change the value of the existing directive) to includes your max input variables:

1
max_input_vars = 3000;

If you don’t have access to this file (as with many shared hosts), you may need to contact your host to increase this limit.

.htaccess

Alternatively, you can try placing this in your

1
.htaccess

. This won’t work on some servers, so your mileage may vary.

1
php_value max_input_vars 3000

Useful Commands For Ubuntu

A comprehensive list of Useful Commands For Ubuntu that we needed when using Ubuntu:

Command privileges.

sudo command – run command as root

sudo su – root shell open

sudo su user – open shell as a user

sudo -k – forget your password sudo

gksudo command – sudo visual dialog (GNOME)

kdesudo command – sudo visual dialog (KDE)

sudo visudo – edit / etc / sudoers

gksudo nautilus – root file manager (GNOME)

kdesudo konqueror – root file manager (KDE)

passwd – change your password


Command Network

ifconfig – displays information network

iwconfig – displays information from wireless

sudo iwlist scan – scan wireless networks

sudo /etc/init.d/networking restart – reset the network

(file) /etc/network/interfaces – manual configuration

ifup interface – bring online interface

ifdown interface – disable interface

Commands Display

sudo /etc/init.d/gdm restart – reset X (Gnome)

sudo /etc/init.d/kdm restart – reset X (KDE)

(file) /etc/X11/xorg.conf – show Configuration

sudo dpkg-reconfigure – reconfigure xserver-xorg-phigh – reset configuration X

Ctrl+Alt+Bksp – X display reset if frozen

Ctrl+Alt+FN – switch to tty N

Ctrl+Alt+F7 – switch back to X display

Commands Service System.

start service – service to start work (Upstart)

stop service – service to stop working (Upstart)

status service – check if service is running (Upstart)

/etc/init.d/service start – start service (SysV)

/etc/init.d/service stop – stop service (SysV)

/etc/init.d/service status – check service (SysV)

/etc/init.d/service restart – reset service (SysV)

runlevel – get current runlevel

Commands for Firewall.

ufw enable – turn on the firewall

ufw disable – turn off the firewall

ufw default allow – allow all connections by default

ufw default deny – drop all connections by default

ufw status – current rules and

ufw allow port – to allow traffic on port

ufw deny port – port block

ufw deny from ip – ip block


Command System.

lsb_release -a – get the version of Ubuntu

uname -r – get kernel version

uname -a – get all the information kernel


Commands for Package Manager.

apt-get update – refresh updates available

apt-get upgrade – update all packages

apt-get dist-upgrade – version update

apt-get install pkg – installing pkg

apt-get remove pkg – uninstall pkg

apt-get autoremove – removing packages obsotletos

apt-get -f install – try to fix packages

dpkg –configure -a – try to fix a broken package

dpkg -i pkg.deb – install file pkg.deb

(file) /etc/apt/sources.list – list of repositories APT

Special Packages For commands.

ubuntu-desktop – Setting the standard Ubuntu

kubuntu-desktop – KDE Desktop

xubuntu-desktop – desktop XFCE

ubuntu-minimal – core earnings Ubuntu

ubuntu-standard – the standard utilities Ubuntu

ubuntu-restricted-extras – not free, but useful

kubuntu-restricted-extras – ditto KDE

xubuntu-restricted-extras – ditto XFCE

build-essential – packages used to compile

linux-image-generic – latest generic kernel image

linux-headers-generic – latest headlines

Applications commands.

nautilus – File Manager (GNOME)

dolphin – File Manager (KDE)

konqueror – Web browser (KDE)

kate – text editor (KDE)

gedit – text editor (GNOME)

How to Leverage Browser Caching with htaccess

What This Code Actually Does?

It will instruct the browser to cache different static resources like images, flash, PDF, JavaScript and icons for some specified period of time. You can also increase or decrease the values depending on your specific requirements. By configuring your web server to set caching headers for cacheable static resources, your site will appear to load much faster

Find your .htaccess file, open it with any text editor (Notepad for instance) and add these codes below. Then save it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 2 days”
</IfModule>
## EXPIRES CACHING ##

 

wordpress and magento web.config file for Microsoft IIS

Windows server did not Use .htaccess Its use web.config for same work that done by htaccess.

Default WordPress .htaccess equivalent in Web.config

1
2
3
4
5
6
7
8
9
10
11
12
<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/{R:0}" />
     </rule>
 </rules>
</rewrite>

Magento .htaccess equivalent in Web.config

1
2
3
4
5
6
7
8
9
<rule name="Imported Rule 1" stopProcessing="true">
  <match url=".*" ignoreCase="false" />
  <conditions>
    <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
  </conditions>
  <action type="Rewrite" url="index.php" />
</rule>

Font Awesome icons showing as squares on Idx pages

Font awesome did not work on Idx pages without enable “Origin and Access-Control-Allow-Origin HTTP headers”.Basically, when a browser with this protection on finds an external font embedded, it sends the base url of the website out in the Origin header and waits for a response. Unless that response allows this origin, the font is denied.

So you need to Allow Cross Domain Fonts
If you’re using an embedded font on your site and want this to work on your IDX pages as well, it will require an extra step to get it working in some browsers. Firefox will not allow fonts to be embedded cross-domain unless you add this to the top-level .htaccess file of the domain or subdomain where your fonts are being served:

1
2
3
4
5
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

If you are using Microsoft’s IIS you need to add some code in the web.config system.webServer block.

1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="Access-Control-Allow-Origin" value="*" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

This sets the Access-Control-Allow-Origin CORS configuration to allow pulling from all domains.