Upgrade PHP 5.x to 7.x

1. Verify current version of PHP

Type in the following to see the current PHP version:

1
php -v

The output should match this:

1
2
3
PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Cool, let’s move on!

 

2. Install the REMI and EPEL repositories

If you don’t already have them, install the Remi and EPEL repositories:

1
2
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Enable the Remi repository globally:

1
nano /etc/yum.repos.d/remi.repo

Under the section that looks like [remi] make the following changes:

1
2
3
4
5
6
7
8
[remi]
name=Remi's RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/
#mirrorlist=https://rpms.remirepo.net/enterprise/7/remi/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Type CTRL-O to save and CTRL-X to close the editor

Enable the Remi PHP7.3 Repository:

1
nano /etc/yum.repos.d/remi-php73.repo

Under the section that looks like [remi-php73] make the following changes:

1
2
3
4
5
6
7
8
[remi-php73]
name=Remi's PHP 7.3 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php73/$basearch/
mirrorlist=https://rpms.remirepo.net/enterprise/7/php73/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/php73/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Make sure you un-comment the HTTPS mirror-list as well. The HTTP mirror seems to run into issues every now and then.

Type CTRL-O to save and CTRL-X to close the editor

 

3. Upgrade PHP 5.4 to PHP 7.3

Now we can upgrade PHP. Just type in the following command:

1
yum -y upgrade php*

Once the upgrade has completed, verify that you have PHP 7.3 installed:

1
php -v

Output should look like:

1
2
3
PHP 7.3.0RC5 (cli) (built: Nov  6 2018 10:22:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies

You’re now running with PHP 7.3!

 

How to install Apache, PHP 7.2 and MySQL on CentOS 7.4 (LAMP)

This tutorial shows how to install an Apache web server on CentOS 7 server with PHP (mod_php) and MySQL database. The acronym LAMP is short for Linux, Apache, MySQL, PHP.

This updated tutorial shows the installation of the latest PHP versions (7.0, 7.1 and 7.2) on CentOS 7.4.

1 Preliminary Note

In this tutorial, I use the hostname server1.example.com with the IP p 192.168.1.100. These settings might differ for you, so you have to replace them where appropriate.

I will add the EPEL repo here to install latest phpMyAdmin as follows:

rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release

To edit files on the shell, I’ll install the nano editor. If you prefer vi for file editing, then skip this step.

yum -y install nano

2 Installing MySQL / MariaDB

MariaDB is a MySQL fork of the original MySQL developer Monty Widenius. MariaDB is compatible with MySQL and I’ve chosen to use MariaDB here instead of MySQL. Run this command to install MariaDB with yum:

yum -y install mariadb-server mariadb

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

systemctl start mariadb.service
systemctl enable mariadb.service

Set passwords for the MySQL root account:

mysql_secure_installation

[root@server1 ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <–ENTER
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]
New password: <–yourmariadbpassword
Re-enter new password: <–yourmariadbpassword
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] <–ENTER
… Success!

Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <–ENTER
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] <–ENTER
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <–ENTER
… Success!

Cleaning up…

All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@server1 ~]#

3 Installing Apache

CentOS 7 ships with Apache 2.4. Apache is directly available as a CentOS 7 package, therefore we can install it like this:

yum -y install httpd

Here a screenshot of the installation process.

Install Apache http server on CentOS

Now configure your system to start Apache at boot time…

systemctl start httpd.service

systemctl enable httpd.service

To be able to access the web server from outside, we have to open the HTTP (80) and HTTPS (443) ports in the firewall. The default firewall on CentOS is firewalld which can be configured with the firewalld-cmd command.

firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –permanent –zone=public –add-service=https
firewall-cmd –reload

Now direct your browser to the IP address of your server, in my case http://192.168.1.100, and you should see the Apache placeholder page:

Apache web server started on CentOS 7

4 Installing PHP

The PHP version that ships with CentOS as default is quite old (PHP 5.4). Therefore I will show you in this chapter some options to install newer PHP versions like PHP 7.0 or 7.1 from Remi repository.

Add the Remi CentOS repository.

rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Install yum-utils as we need the yum-config-manager utility.

yum -y install yum-utils

and run yum update

yum update

Now you have to chose which PHP version you want to use on the server. If you like to use PHP 5.4, then proceed to chapter 4.1. To install PHP 7.0, follow the commands in chapter 4.2, for PHP 7.1 chapter 4.3 and for PHP 7.1, use chapter 4.4 instead. Follow just one of the 4.x chapters and not all of them as you can only use one PHP version at a time with Apache mod_php.

4.1 Install PHP 5.4

To install PHP 5.4, run this command:

yum -y install php

4.2 Install PHP 7.0

We can install PHP 7.0 and the Apache PHP 7.0 module as follows:

yum-config-manager –enable remi-php70

yum -y install php php-opcache

4.3 Install PHP 7.1

If you want to use PHP 7.1 instead, use:

yum-config-manager –enable remi-php71

yum -y install php php-opcache

4.4 Install PHP 7.2

If you want to use PHP 7.2 instead, use:

yum-config-manager –enable remi-php72

yum -y install php php-opcache

In this example and in the downloadable virtual machine, I’ll use PHP 7.2.

We must restart Apache to apply the changes:

 systemctl restart httpd.service

5 Testing PHP / Getting Details About Your PHP Installation

The document root of the default website is /var/www/html. We will create a small PHP file (info.php) in that directory and call it in a browser to test the PHP installation. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

nano /var/www/html/info.php

<?php
phpinfo();

Now we call that file in a browser (e.g. http://192.168.1.100/info.php):

PHP 7.2 installed on CentOS 7

As you see, PHP 7.2 is working, and it’s working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP. MySQL is not listed there which means we don’t have MySQL support in PHP yet.

6 Getting MySQL Support In PHP

To get MySQL support in PHP, we can install the php-mysqlnd package. It’s a good idea to install some other PHP modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

yum search php

Pick the ones you need and install them like this:

yum -y install php-mysqlnd php-pdo

In the next step I will install some common PHP modules that are required by CMS Systems like WordPress, Joomla, and Drupal:

yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel

Now restart Apache web server:

 systemctl restart httpd.service

Now reload http://192.168.1.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules like curl etc there.:

MySQL support added to PHP 7.2 on CentOS

If you don’t need the php info output anymore, then delete that file for security reasons.

rm /var/www/html/info.php

7 phpMyAdmin installation

phpMyAdmin is a web interface through which you can manage your MySQL databases.
phpMyAdmin can now be installed as follows:

yum -y install phpMyAdmin

Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <RequireAny> stanza and adding the ‘Require all granted’ line):

nano /etc/httpd/conf.d/phpMyAdmin.conf

[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

 <IfModule mod_authz_core.c>
 # Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
 Require all granted
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2
 Order Deny,Allow
 Deny from All
 Allow from 127.0.0.1
 Allow from ::1
 </IfModule>
</Directory>


<Directory /usr/share/phpMyAdmin/>
        Options none
        AllowOverride Limit
        Require all granted
</Directory>

[...]

Next, we change the authentication in phpMyAdmin from cookie to http:

nano /etc/phpMyAdmin/config.inc.php

[...]
$cfg['Servers'][$i]['auth_type']     = 'http';    // Authentication method (config, http or cookie based)?
[...]

Restart Apache:

systemctl restart  httpd.service

Afterwards, you can access phpMyAdmin under http://192.168.1.100/phpmyadmin/:

PHPMyAdmin installed on CentOS 7.4

8 Download as virtual machine

This setup is available as virtual machine download in ova/ovf format (compatible with VMWare and Virtualbox) for howtoforge subscribers.

Login details for the VM

  • The Linux root password is: howtoforge.
  • Rhe MySQL root password is: howtoforge

Please change both passwords on the first login.

  • The IP address of the VM is 192.168.1.100

Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
CentOS: http://www.centos.org/
phpMyAdmin: http://www.phpmyadmin.net/

Source: Shttps://www.howtoforge.com/tutorial/centos-lamp-server-apache-mysql-php/

Reset the MariaDB Root Password

If you forget your root MariaDB password, it can be reset.

  1. Stop the current MariaDB server instance, then restart it with an option to not ask for a password:
    sudo systemctl stop mariadb
    sudo mysqld_safe --skip-grant-tables &
    
  2. Reconnect to the MariaDB server with the MariaDB root account:
    mysql -u root
    
  3. Use the following commands to reset root’s password. Replace password with a strong password:
    use mysql;
    update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
    flush privileges;
    exit
    
  4. Then restart MariaDB:
    sudo systemctl start mariadb

Ketika MacBook-mu loop boot Setelah Update OSX, Backup data-mu dengan langkah ini

Ini gw alami ketika update OSX via online. Gw gatau kenapa dia boot-loop dan dalam posisi loading… yang ga berkesudahan. Udah coba restart dan shutdown berulang2 juga ga ngaruh. Coba bawa ke MacArena di Ambassador Plaza, malah ditawarin format dan install ilang dengan konsekuensi data gw ilang dan ga bisa diselamatin plus bayar 250rb perak. Ogah donk gw wkwkwk..
Ya udah, gw balik kanan, lalu lanjutin googling lagi, dan nemuin banyak artikel menarik. Jadi saran gw ketika lo nemuin masalah dalam hidup lo (eaaaa…) lo googling aja, karena lo ga sendiri dan orang lain udah pernah ngalamin sebelum elo..

Okok.. gw dah banyak bacot diatas.. ini gw pastein langkahnya..

We are using OS X El Capitan. Earlier OS X versions have slightly different interface. 

1-Connect your external hard drive to your Mac (yes you need an external hard disk). Make sure this drive has enough spare disk space to store your backup files.

2-Boot your Mac into Recovery Mode. Follow the steps to do this:

  • Shut down your Mac
  • Restart your Mac and hold down the Command and R keys immediately after you hear the startup chime.  Keep holding them until you see the Apple logo.
  • Wait until you see the OS X Utilities windows
  • Select Disk Utility and click Continue

Disk Utility

  • Select the Disk you want to back up, such as Macintosh HD

Macintosh HD

  • Select File > New Image > Image from “Macintosh HD or Your Drive”

system image of Mac

  • You may change its name, if you want to

back up disk utility

  • Select your external drive
  • Choose “compressed”
  • Select Save
  • Your backup process will start. It may take some time.

3- You will notified you when the process is done.

If you get a new Mac, and want to restore your back up, you may use Migration Assistant transfer the data back to your Mac.

Making backups of your files is important. Before losing anything, back up now. You may want to use the OS X Time Machine feature to easily create back up files. That is the easiest way to back up your Mac. You may also use iCloud to back up some of your files like musics, photos etc.

Mac Pro :: One Or More Items Can’t Be Changed Because They Are In Use

Screen Shot 2017-11-15 at 10.39.12 AM.png

Just to update – that command worked perfectly. I had over 200 files however, and didn’t want to run through each one. This command, when run in the directory of the offending files, will find all files and fix them.
Code:

for f in *.*; do xattr -d com.apple.FinderInfo "$f"; done

I know this is an old thread, but I just stumbled across it tonight whilst having the same issue in El Cap. Hope this helps someone!

How to Install PHP 7.x on CentOS 7

Step 1: Setup the Webtatic YUM repo

Precompiled PHP 7.x binaries are available for CentOS 7 from the WebtaticIUS, or Remi’s RPM repositories.

Below are instructions on installing PHP 7.x using the Webtatic YUM repo.

Setup the Webtatic YUM repo:

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Step 2: Install PHP 7.1 and necessary extensions

Install PHP 7.1 and some of the most commonly used extensions:

sudo yum install -y mod_php71w php71w-cli php71w-common php71w-gd php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-xml

Note: The above packages are for general purpose use and may not suit your specific requirements. You should confirm the packages to be installed referring to the Webtatic PHP 7.1 introduction page.

Alternatively, if you want to install PHP 7.0, you should refer to Webtatic PHP 7.0 introduction page.

Step 3: configure PHP 7.x

After the installation, the PHP 7.x configuration file will be saved as /etc/php.ini. If necessary, you can use the vi text editor to modify it:

sudo cp /etc/php.ini /etc/php.ini.bak
sudo vi /etc/php.ini

Remember to restart your web server after modifying the /etc/php.ini file.

For Apache:

sudo systemctl restart httpd.service

For Nginx:

sudo systemctl restart nginx.service php-fpm.service

That’s it. Thanks for reading.

Update WP

  1. Get the latest WordPress zip (or tar.gz) file.
  2. Unpack the zip file that you downloaded.
  3. Deactivate plugins.
  4. Delete the old wp-includes and wp-admin directories on your web host (through your FTP or shell access).
  5. Using FTP or your shell access, upload the new wp-includes and wp-admin directories to your web host, in place of the previously deleted directories.
  6. Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).
  7. Upload all new loose files from the root directory of the new version to your existing wordpress root directory.

Reset MySQL Root Password on CentOS 7

1. Stop mysql:
systemctl stop mysqld

2. Set the mySQL environment option 
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

3. Start mysql usig the options you just set
systemctl start mysqld

4. Login as root
mysql -u root

5. Update the root user password with these mysql commands
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword')
    -> WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

6. Stop mysql
systemctl stop mysqld

7. Unset the mySQL envitroment option so it starts normally next time
systemctl unset-environment MYSQLD_OPTS

8. Start mysql normally:
systemctl start mysqld

Try to login using your new password:
7. mysql -u root -p