Search found 212 matches

by chris
Sat Sep 19, 2020 2:46 pm
Forum: Shell
Topic: Bash last char of a string
Replies: 2
Views: 82380

Re: Bash last char of a string

you can also use:

Code: Select all

echo ${STRING: -1}
Just remember that the last character can sometimes be a whitespace ( space, newline ...)
by chris
Tue Sep 08, 2020 1:43 pm
Forum: SQL
Topic: Join 1 table on 2 different tables
Replies: 1
Views: 45675

Re: Join 1 table on 2 different tables

You can work with a sub-query an UNION:

Code: Select all

SELECT table1.id,union_table.name FROM table1 LEFT JOIN 
   (SELECT id,name FROM table2 UNION SELECT id,title AS name FROM table3) 
   AS union_table ON table1.other_id=union_table.id;
by chris
Thu Apr 23, 2020 6:59 am
Forum: SQL
Topic: Solved: Incorrect date value: '0000-00-00' for column
Replies: 2
Views: 51356

Re: Incorrect date value: '0000-00-00' for column

The error is because MYSQL is in strict mode (default)

You can Check MYSQL mode
SELECT @@GLOBAL.sql_mode global, @@SESSION.sql_mode session


You change it with the following query;
SET sql_mode = '';
or
SET GLOBAL sql_mode = '';
Using the keyword GLOBAL requires super privileges and it ...
by chris
Mon Mar 30, 2020 8:14 pm
Forum: Servers
Topic: Linux startup script
Replies: 1
Views: 54054

Re: Linux startup script

There are several ways to run a script on startup/reboot on linux.

My favorite : Crontab

sudo crontab -e
@reboot /home/me/scripts/this.sh


Another way to do it,
local.d scripts at boot time, add its init.d script to the default runlevel.
Enable local.d Scripts
rc-service local start
and then ...
by chris
Fri Mar 20, 2020 9:23 pm
Forum: MySQL
Topic: php mysqli_connect: authentication method unknown to the client [caching_sha2_password]
Replies: 1
Views: 52141

Re: php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

MYSQL has changed it type of password (since Mysql 8 ?)
Anyway the easiest solution, is execute the following SQL command on MYSQL

Code: Select all

ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
It should solve your problem.
by chris
Sun Feb 16, 2020 9:02 pm
Forum: Postfix
Topic: postfix not mail from other hosts
Replies: 4
Views: 87289

Re: postfix not mail from other hosts

Are you sure you are sending it to the right account?

sometimes you need to also add the domain name (even if it is not a public domain).

Code: Select all

sendmail user@host.domain.com
by chris
Sun Feb 16, 2020 1:10 pm
Forum: Postfix
Topic: postfix not mail from other hosts
Replies: 4
Views: 87289

Re: postfix not mail from other hosts

are you sending to a user on the server.
Do a test from the client:

Code: Select all

sendmail user@host
and check the logs on the client and on the server.
by chris
Sun Oct 13, 2019 7:25 pm
Forum: WordPress
Topic: Wordpress change login page
Replies: 1
Views: 66060

Re: Wordpress change login page

You can follow the tutorial :
https://www.inmotionhosting.com/support/website/wordpress-plugins/hiding-your-wordpress-admin-url-with-ithemes-security

But for you new login page, I think it is best to manual make a copy of wp-login.php to newlogin.php .

It is really good to rename wp-login.php ...
by chris
Wed Aug 28, 2019 7:10 pm
Forum: Postfix
Topic: postfix forward mail to multiple recipients
Replies: 2
Views: 97823

Re: postfix forward mail to multiple recipients

Be careful to which email-address you forward.
For example;
if you forward an email coming from gmail to gmail,
It will probably be flagged as spam. Because gmail knows that your server should not send email coming from gmail
(or any other known email-providers).

To prevent this you could do it ...
by chris
Sun Jun 30, 2019 9:30 am
Forum: WordPress
Topic: Move wordpress site to directory
Replies: 1
Views: 68928

Re: Move wordpress site to directory

It is a complicated process.
Moving the files from subdir to the root,
is the first step, but some additional steps are needed.

Actual the first step should always be tot do a backup of your files and of the database.

Preparation

Backup the files and the database!
Remove any old site files ...