Wednesday, June 1, 2016

How to Fix Permissions on Files and Directories by SSH

Sometimes plugins or other features can mess up the permissions for a file or directory(folder) on your site and make it impossible for you to access something or upload something. The easiest way to fix this is with SSH access. If you do not have SSH access, contact your host and see if they allow it and can enable it for you.

To get SSH access enabled on BlueHost, see: http://helpdesk.bluehost.com/index.php/kb/article/000180

You can use the following two lines to reset your permissions. Note that the default directory permissions are 755 and the default file permissions are 644, so that is what I will show here, however, if your webhost says you need other permissions for something, then you can change the numbers. Beware of 777 permissions though, as they are a security threat! If you are told to use 777, first try it with 755 and 644, if that doesn’t work, then carefully add 777 permissions only where you need it.

Here are the SSH commands to fix your permissions on a mass level:
find ~/public_html -type d -exec chmod 755 {} \;
find ~/public_html -type f -exec chmod 644 {} \;
Basically, the format is to find, or look, in the path of ~(which means home) and then in public_html. (If you want to look in a different directory, you can change this. e.g. ~/public_html/myblog) And then it looks for the document type, be it directory (d) or file (f), and executes the chmod(change mode) command to change the permissions on all results.

Be very careful with these commands!
If you accidentally break something, it can be difficult to fix. For example, if you have cgi or perl files, they will need 755 permissions instead of 644 in order to operate properly. If you have questions in regards to this, you might want to ask first.
Be Sociable, Share!

Wednesday, February 10, 2016

How should I disable the enabled xdebug in wamp server

Goto

wamp > bin > php > php5.5.12 > php.ini
wamp > bin > apache > apache2.4.9 > bin > php.ini

Find for

[xdebug]
zend_extension ="D:/wamp/bin/php/php5.4.45/zend_ext/php_xdebug-2.3.3-5.4-vc9.dll"

All you need to do is add a comment character (;) to that line like this

[xdebug]
;zend_extension ="D:/wamp/bin/php/php5.4.45/zend_ext/php_xdebug-2.3.3-5.4-vc9.dll"

That's all :)


Tuesday, November 3, 2015

How can I put my email with one host and website with another

Nowadays there are a ton of options when researching what an “ideal” web hosting solution should be. You might find that you’ve outgrown your current platform, or perhaps you want to go with something a bit more simplistic like dragging and dropping rather than teaching yourself HTML or CSS.
After you decided to take the plunge of switching hosting providers, you find yourself researching how to make transition as smooth as possible. You’ve accomplished updating the “A records” to the servers’ new home and breathe a sigh of relief only to realize that you’re inbox has become silent and refuses to cooperate.
Doh! “What about the email servers? Do I have to switch email over to the new hosting provider?” you ask yourself. The answer is “no.” You can manage your email the way you always have, but your new hosting provider’s DNS needs to know where to find it.
Assuming you chose to keep your email provider (server) just the way it was and not migrate your email over to your new hosting provider, then there are key steps you must take to ensure your email stays intact while the website’s domain thrives in its new habitat.
What often happens is that the Mail Exchanger (MX) record is pointing to yourdomain.com – but because you just changed yourdomain.com to point somewhere else (remember when you updated the A record so the web domain will have a new home?) @yourdomain.com is no longer working for email.
No need to panic. You don’t have to be a DNS guru to split your email from your website hosting. It’s actually quite painless, read on…
So How Can I Keep My Email Provider Separate From Web Hosting Provider?
For those of us who don’t go underneath the DNS hood every day, there are two key pieces you need to know if you want your email provider to reside separately from your website hosing provider.
  1. The mail server must know about the new name server (the DNS server keeping track of the domain names and IP addresses). So we must define your “A (host) record” for mail, which we’ll explain in detail in a moment.
  2. The Internet must know where the email is being  processed (this is the job of the MX record)
Let’s walk through a real world scenario:
Say you were using a hosting provider which also included email) but decided to switch to a different hosting company (e.g. Weebly*) and wanted to leave email with the current hosting company.
To accomplish this, you would just change your A records for www.yourdomain.com (and the non-www version, yourdomain.com) to the IP address of your new hosting provider (which they provide) but don’t stop there. To ensure email works the way it always has, you must ensure mail.yourdomain.com is pointing to its existing IP address AND then change the MX record to now point to mail.yourdomain.com.
In your DNS Zone Editor Section, you can make updates to your DNS records.
Screenshot shows example IP addresses (be sure to use your own IP addresses accordingly):

Will this work on Email Hosted By Godaddy, InMotion, JustHost, or HostGator?
Yes – regardless of the email provider or web hosting provider, the rules described above are the same. DNS settings containing your A records and MX records are universal (if they weren’t, then the Internet would not have grown beyond a laboratory of a few computers).
How Long Does It Take Before I Start Seeing My Email Again?
After updating the MX record and A record, propagation (the fancy word which simply means “for the rest of the Internet to catch up”) can take as little as 3 hours but as many as 48 hours. It varies, so you’re not seeing the results you expected, be sure to give it the full 48 hours.
Tip: You can check how other servers around the world are acknowledging your changes (DNS propagation) by using a free DNS checker found at http://www.whatsmydns.net/.


*If really using Weebly, keep in mind they don’t host email, and I advise against using their recommendation of the costly Google Apps that run $60/year per mailbox!

Thursday, August 13, 2015

Owner root gets "Operation not permitted" on chmod, rm -rf

Bug : rm -rf, chmod as root: permission denied?

Solution :

$ chattr -i dir
$ rm -rf dir

Saturday, June 6, 2015

500 error with suphp configuration

Solution :

Use it in your .htacess

#Use PHP 5.4
# Use PHP54 as default
#AddHandler application/x-httpd-php54 .php
<IfModule mod_suphp.c>
    suPHP_ConfigPath /opt/php54/lib
</IfModule>


Wednesday, May 13, 2015

Reset or Set Default Permissions to Domain for Files and Directories in cPanel

If your permissions are incorrect for files and folders in a webroot domain more than likely you’ll get a server 500 error. Here is how to fix them by resetting, especially using the correct defaults for a cPanel domain or other web server for files and directories.


You can bulk fix these permissions on the command line, with these commands:
cd /home/yourdomain/public_html/
 
Go to your webroot directory

find . -type d -exec chmod 755 {} \;
 
Fix the permissions on directories

find . -type f -exec chmod 644 {} \;
 
Fix the permissions on files

Sunday, May 10, 2015

Symlink find

find /home*/*/public_html -type l >> /root/symlinks.txt