Increase PHP Upload Size Limitation

How To, Linux, PHP, WordpressLeave a comment

Every server running has limitations including file upload, If you need to upload bigger file, you need to adjust PHP settings. If you are running web server on Linux, mostly you can search the settings file on /etc/php5/apache2/php.ini if your web server running on Windows(xampp/wampp) mostly you’ll find it on \wamp\bin\php\php5.4.12\php.ini Just open that file with plain text editor. Do a search for upload_max_filesize and post_max_size

Here’s the end result for my setting’s file:
; Maximum size of POST data that PHP will accept.
post_max_size = 50M


; Maximum allowed size for uploaded files.
upload_max_filesize = 50M

You need to reload / restart the Apache’s service after that.
[email protected]:/etc/init.d/apache2 reload

Test the upload now.

Protecting Your WordPress Admin with htaccess

Linux, Wordpress1 Comment

Everyone can easily guess how to enter your WordPress Admin Dashboard, yes by default it’s Someone with evil-minded can easily target that login url using a brute-force software to try every username and password combination, that’s why we should never use a word based easy-guess password.

One of the basic protection is to use .htaccess, I’ll show you how to do it.

Creating .htpasswd

First of all, create locally a file named .htpasswd, then generate a username and encrypted password using .htpasswd generator. Copy the result and paste into your newly created file.


Then upload the file into your server, you can put it somewhere inside or outside public_html folder. In me case I put it into /home/pupung/

Creating .htaccess

Next step is to create .htaccess file, create .htaccess file with the same way you did on .htaccess, here’s my code:
ErrorDocument 401 “Denied”
ErrorDocument 403 “Denied”

# Allow plugin access to admin-ajax.php
# around password protection

Order allow,deny
Allow from all
Satisfy any

AuthType Basic
AuthName “Admin Only”
AuthUserFile /home/pupung/.htpasswd
Require valid-user

and upload it to wp-admin folder.

You can test it by visiting your admin URL and you will be prompted by a dialog box requested username and password.


Protecting wp-login.php

One more thing to do is protecting wp-login.php which is reside inside your root instalation of WordPress. I use the code below to protect it, just add after your WordPress’ .htaccess lines.

AuthName “Login Required”
AuthType Basic
AuthUserFile /home/pupung/.htpasswd
Require valid-user


Well done, now your wp-admin protected. Actually there are few more tricks how to protect your WordPress instalation, I’ll share it in another post. Thanks for reading.

Make Your Server To Update WordPress Seamlessly

How To, Linux, Wordpress, , Leave a comment

If you have issue doing “one click” WordPress upgrade on your server. This might be usefull for you:

First of all, include your username to “www-data” group.

[shell]# usermod -a -G www-data pupungbp[/shell]

then, change group ownership of your www files to www-data

[shell]# chgrp -R www-data /home/pupungbp/sites/[/shell]

add capability to group to have write access

[shell]# chmod -R g+w /home/pupungbp/sites/[/shell]

find and change directory permission to 775 (owner and group writeble)

[shell]# find /home/pupungbp/sites -type d -exec chmod 2775 {} \;[/shell]

give read and write access to user and group on files

[shell]# find /home/pupungbp/sites -type f -exec chmod ug+rw {} \;[/shell]

Last step, open up your wp-config.php and add this following code at the top of the file.


Lets try to upgrade your WordPress update or plugins. Cheers.