Increase the memory-limit in php

When you run wordpress under xamm,
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 334230 bytes) in D:\xampp\htdocs\test.php on line814.

 1. Open \xampp\apache\bin\php.ini .Do not go to the directory of phpt to find php5.ini .
2. Search”memory” and get the following:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 60     ; Maximum execution time of each script, in seconds
max_input_time = 60    ; Maximum amount of time each script may spend parsing request data
memory_limit = 32M      ; Maximum amount of memory a script may consume (16MB)

3. Modify the value of “memory_limit =” ,usuall change it to 64M.

4. Reboot Apache.

Posted in Apache, Php Functions, WordPress. Comments Off on Increase the memory-limit in php »

How to use htaccess to change site.com/directory/ to site.com/ ?

If you only want http://kingphp.com/money directory become http://kingphp.com, use:RewriteRule ^catalog/$ / [L]

If you want all directories become http://kingphp.com, use:
RewriteEngine On
RewriteBase /

RewriteRule ^([^/]+)$ /catalog/$1 [L]
RewriteRule ^$ /catalog/ [L]

Note:If you have other subfolders in there (in that catalog dir, you’ll need some additional rule for that also. This will rewrite your files from catalog/ subfolder to your main url.

Posted in Apache. Comments Off on How to use htaccess to change site.com/directory/ to site.com/ ? »

How to use mod rewrite forward to a new domain?

For examples, when we visit www.google.com, we want it redirect to http://kingphp.com, we can use the following code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

The code posted above should be used on the old server.

Posted in Apache. Comments Off on How to use mod rewrite forward to a new domain? »

How to redirect folders (and all the link)

For example, if we want to redirct http://kingphp.com/php/ to http://kingphp.com/wordpress/

We could use mod_rewrite. Put this in your .htaccess file

Options +FollowSymLinks
RewriteEngine On
RewriteRule /php/(\w+).html /wordpress/$1.html [R=301,L]

Posted in Apache. Comments Off on How to redirect folders (and all the link) »

Using .htaccess pointing domain to specific directory

If a server hosting 2 domains, we can use this .htaccess (on the root) to point the 2 different domains to 2 Directories on the same server:

RewriteEngine On
RewriteBase /

# pointing for the domain domain1.com to folder1
ReWriteCond %{HTTP_HOST} domain1.com
ReWriteCond %{REQUEST_URI} !folder1/
ReWriteRule ^(.*)$ folder1/$1 [L]

# pointing for the domain domain2.com to folder2
ReWriteCond %{HTTP_HOST} domain2.com
ReWriteCond %{REQUEST_URI} !folder2/
ReWriteRule ^(.*)$ folder2/$1 [L]

Posted in Apache. Comments Off on Using .htaccess pointing domain to specific directory »

WordPress Permalinks Does Not Work in xampp Setup

xampp provides a convenient way to quickly and easily install and setup a web server that works without much configuration. However, permalinks feature won’t work with the default installation of xampp, even though you can properly customize the permalinks structure to create the .htaccess file. (more…)

Posted in Apache, WordPress. Comments Off on WordPress Permalinks Does Not Work in xampp Setup »

.htaccess redirect ALL traffic to another domain

.htaccess code:
redirect 302 / http://www.mynewdomain.com

you can also redirect access via PHP, using the header() function:

// Permanent redirect:
header('HTTP/1.1 301 Moved Permanently', true);
header('Location: http://www.location.com/');
// Temporary redirect (note that sending the 'Location' header automatically sends a 302 redirect unless it is explicitly overwritten, as it is above):
header('Location: http://www.location.com/');

Posted in Apache, Php Code. Comments Off on .htaccess redirect ALL traffic to another domain »

How to insert PHP code into HTML?

To be able to use php code on a page with an extension other than .php, you need a server which supports .htaccess files.
To add an extension to be parsed for php, create or edit a file called .htaccess (with the dot first) containing the following line: (more…)

Posted in Apache, Php Study. Comments Off on How to insert PHP code into HTML? »

The application failed to initialize properly( 0xc0150002).Click on OK to terminate application

Today when I install XAMPP (www.apachefriends.org), an error comes out “The application failed to initialize properly( 0xc0150002).Click on OK to terminate application”, I search the internet and found the method to resolve the problem, it is very easy, just download and install the Visual C redistributable: http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=200b2fd9-ae1a-4a14-984d-389c36f85647&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fe%2f1%2fc%2fe1c773de-73ba-494a-a5ba-f24906ecf088%2fvcredist_x86.exe

(more…)

Posted in Apache. Comments Off on The application failed to initialize properly( 0xc0150002).Click on OK to terminate application »
12
King Php Science Welcome, you are from: 54.158.25.146