Tagged: .htaccess

Add basic authentication in phpMyAdmin in CentOS 7

Problem: Want to increase phpMyAdmin security, for example adding one more gateway before entering username and password in xxx/phpmyadmin

This is possible and can be achieved in two way:

Solution: first find out where the PHPMyAdmin folder

find /etc/httpd/ -print0 | xargs -0 grep phpmyadmin

then create a .htpasswd  file for the user you want, like user1.

sudo htpasswd -c /etc/httpd/.htpasswd user1

the output will look like this:

user1:$apr1$0r/2zNGG$jopiWY3DEJd2FvZxTnugJ/

Way 1 -- edit /etc/httpd/conf/httpd.conf , change into below content:

<Directory /usr/share/phpmyadmin>
    AuthType Basic
    AuthName "Restricted Content"
    AuthUserFile /etc/httpd/.htpasswd
    Require valid-user
</Directory>

Way 2 -- go to phpMyAdmin folder that finds out via the previous command, add .htaccess file with below content:

AuthType Basic
AuthName "Admin Login"
AuthUserFile /etc/httpd/pma_pass
Require valid-user

Import 50000 tags used on Stack Overflow to WordPress

This site contains different domain knowledge so if I can label my process documentation it will make it easier for others to find. Then I find out Stack Overflow, the largest question and answer site for IT professionals, provide Data Explorer to get all the Tags used on Stack Overflow.

Below are the steps to import these tags into own WordPress:

  • If you use CloudFlare or similar service, turn it off first. Otherwise, it will cause Error 524 (A timeout occurred)
  • Turn the tags list into XML format, you don’t have to add wp:term_id and wp:tag_slug . The result will be like this
<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/"xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/">
<channel>
<wp:wxr_version>1.2</wp:wxr_version>
<wp:tag>
<wp:tag_name><![CDATA[javascript]]</wp:tag_name>
</wp:tag>
<wp:tag>
<wp:tag_name><![CDATA[java]]></wp:tag_name>
</wp:tag>
</channel>
</rss>
  • Change the php_value max_execution_time to a longer number since it cause few hours to import 50000 tags, for me I set it to 6 hours (6 hours * 60 * 60 = 21600 sec ). Edit .htaccess in the project and append this line
max_execution_time = 21600
  • Go to WordPress -> Tools -> Import -> WordPress Run Importer. Make sure the maximum size above 3.72 MB. If you haven’t edit .htaccess in the project youcan append this line. 10M would be enough.
php_value upload_max_filesize = 10M
  • Import it, the page will keep refresh util it’s done.
  • Import is done, add a post and select tags.

29/3/2019

I fix the “Sorry, this file type is not permitted for security reasons” issue when I trying to upload the Stackoverflow tags file so you don’t need to do the formatting and can import all the tags. A lazy way for you guys 🙂

You can run the CSV Importer and the CSV file then you are good to go

WordPress change maximum media upload size

Problem: Using WordPress to upload media or plugin exceed the maximum upload size in WordPress (2MB in my case)

By default, the maximum upload size in WordPress ranges from 2MB to 150MB depending on the settings of your web hosting provider is giving by default. Error statement: xxx exceeds the maximum upload size for this site.

Solution: Edit the php.ini file in the WordPress folder, append below line

php_value upload_max_filesize 1000M

This will change the maximum upload to 1000M. You can find other ways at https://www.cloudways.com/blog/increase-media-file-maximum-upload-size-in-wordpress/

Secured By miniOrange