You are reading the article Upgrade Php Version To Php 7.4 On Ubuntu updated in December 2023 on the website Hatcungthantuong.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 Upgrade Php Version To Php 7.4 On Ubuntu
Upgrade PHP version to PHP 7.4 on Ubuntu. You can upgrade your current PHP version to the latest release PHP 7.4 on your Ubuntu 18.04.
This upgrade is tested on virtual machine instance running Ubuntu 18.04 OS on Google Cloud Compute Engine. So the steps mentioned in this guide works on any cloud servers like AWS, DigitalOcean, Linode, Vultr or any VPS or Dedicated servers running Ubuntu 18.04.
Here is a brief guide to show you how to install and upgrade to PHP 7.4 on Ubuntu 18.04 LTS with Apache and PHP7.4-fpm with Nginx.
You can follow this guide to Upgrade to PHP 8
Add PPA for PHP 7.4Add the ondrej/php which has PHP 7.4 package and other required PHP extensions.
Once you have added the PPA you can install PHP 7.4.
ADVERTISEMENT
Install PHP 7.4 for ApacheExecute the following command to install PHP 7.4
sudo apt install php7.4 Install PHP 7.4 ExtensionsInstalling PHP extensions are simple with the following syntax.
sudo apt install php7.4-extension_name
Now, install some commonly used php-extensions with the following command.
ADVERTISEMENT
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -yAfter the installation has completed, you can confirm the installation using the following command
php -v Enable PHP 7.4 for ApacheNow you need to tell Apache to use the installed version of PHP 7.4 by disabling the old PHP module (below I have mentioned php7.0, you need to use your current php version used by Apache) and enabling the new PHP module using the following command.
sudo a2dismod php7.0
sudo a2enmod php7.4
Restart Apache for the changes to take effect.
ADVERTISEMENT
sudo service apache2 restart Install PHP 7.4 FPM for NginxFor Nginx you need to install FPM, execute the following command to install PHP 7.4 FPM
sudo apt install php7.4-fpmFollow the same method above mentioned to install the extensions
After the installation has completed, confirm that PHP 7.4 FPM has installed correctly with this command
php-fpm7.4 -v Modify Nginx configuration to use PHP 7.4For Nginx you need to update the PHP-FPM socket in your Nginx configration located inside the sites-available directory. This will be located inside the location block location ~ .php$
Edit your configuration…
sudo nano /etc/nginx/sites-available/your.conf
The line you need to modify will look like this…
fastcgi_pass unix:/run/php/php7.0
-fpm.sock;You need to replace the old PHP version with the new version.
fastcgi_pass unix:/run/php/php7.4
-fpm.sock;Test your configration.
sudo nginx -tSave the file and exit the editor and restart Nginx for the changes to take effect.
sudo service nginx restart Configure PHP 7.4Now we configure PHP for Web Applications by changing some values in php.ini file.
For PHP 7.4 with Apache the php.ini location will be in following directory.
sudo nano /etc/php/7.4/apache2/php.iniFor PHP 7.4 FPM with Nginx the php.ini location will be in following directory.
sudo nano /etc/php/7.4/fpm/php.iniHit F6 for search inside the editor and update the following values for better performance.
Once you have modified your PHP settings you need to restart your Apache for the changes to take effect.
Configure PHP 7.4 FPM PoolsPHP 7.4 FPM allows you to configure the user and group that the service will run under. You can modify these with these commands
Change the following lines by replacing the www-data with your username.
user =username
group =username
listen.owner =username
listen.group =username
Hit CTRL+X and Y to save the configuration and check if the configuration is correct and restart PHP.
Restart PHP 7.4 FPMOnce you have updated your PHP FPM settings you need to restart it to apply the changes.
sudo php-fpm7.4 -t sudo service php7.4-fpm restartPrepare yourself for a role working as an Information Technology Professional with Linux operating system
ConclusionNow you have learned how to upgrade PHP to PHP 7.4 on Ubuntu 18.04.
You're reading Upgrade Php Version To Php 7.4 On Ubuntu
Install Php 7.4 On Centos 8 / Rhel 8
Install PHP 7.4 on CentOS 8 RHEL 8. This guide let you learn how install the latest PHP version 7.4 on your CentOS system or your CentOS server on any VPS or any Cloud or any Dedicated hosting and configure it with Apache and Nginx.
The latest PHP 7.4 version is released on November 28th, 2023. It comes with a number of new features and a few incompatibilities that you should be aware of before upgrading from the previous version.
This installation is tested on Google Cloud Platform with a Compute Compute Engine VM Instance. This set up will work on all Linux servers.
Prerequisites
A CentOS server set up with sudo privileges.
Completed the initial CentOS server setup. You can choose CentOS 8 for boot image
If you are using Google Cloud Platform to install PHP you need the following steps to be done.
A running Compute Engine, see the Setting up Compute Engine Instance with CentOS.
Here are some cloud hosting providers you can choose from with very low cost and free trial.
PlatformRAMSSDCost Kamatera Cloud1 GB20 GB$4/moAlibaba Cloud1 GB20 GB$8/mo
Getting StartedMake sure your CentOS server is having the latest packages by running the following command.
ADVERTISEMENT
sudo yum update sudo yum upgradeThis will update the package index and update the installed packages to the latest version.
Add EPEL and REMI repositoriesAdd the EPEL and REMI repositories which has PHP 7.4 package and other required PHP extensions.
Once you have added these repositories you can install PHP 7.4.
ADVERTISEMENT
Install PHP 7.4Execute the following command to install dnf. Then you can install PHP.
sudo dnf -y install dnf-utilsEnable php:remi-7.4 module to install PHP 7.4.
sudo dnf module install php:remi-7.4After the installation has completed, you can confirm the installation using the following command
ADVERTISEMENT
php -v Install PHP 7.4 ExtensionsInstalling PHP extensions are simple with the following syntax.
sudo yum install php-extension_name
Now you can install some commonly used php-extensions for WordPress with the following command.
sudo yum install -y php-dom php-simplexml php-ssh2 php-xml php-xmlreader php-curl php-date php-exif php-filter php-ftp php-gd php-hash php-iconv php-json php-libxml php-pecl-imagick php-mbstring php-mysqlnd php-openssl php-pcre php-posix php-sockets php-spl php-tokenizer php-zlib Configure PHP 7.4Now we configure PHP for Web Applications by changing some values in php.ini file.
For PHP 7.4 with Apache the php.ini location will be in following directory.
sudo nano /etc/php.iniHit F6 for search inside the editor and update the following values for better performance.
Once you have modified your PHP settings you need to restart your Apache for the changes to take effect.
Configure PHP 7.4 FPM PoolsPHP 7.4 FPM allows you to configure the user and group that the service will run under. You can modify these with these commands
Change the following lines by replacing the www-data with your username.
user =username
group =username
listen.owner =username
listen.group =username
Hit CTRL+X and Y to save the configuration and check if the configuration is correct and restart PHP.
Restart PHP 7.4 FPMOnce you have updated your PHP FPM settings you need to restart it to apply the changes.
sudo php-fpm7.4 -t sudo service php7.4-fpm restartNow you are having PHP 7.4 Installed and configured.
Prepare yourself for a role working as an Information Technology Professional with Linux operating system
ConclusionNow you have learned how to install PHP 7.4 on your CentOS server.
Core Php Interview Questions And Answers In 2023
Introduction to Core PHP Interview Questions and Answers
Core PHP is actually the meaning of very basic PHP. It is normally used for creating some dynamic web pages for displaying to the end client through their own browser. It has basic core logic of programming on the server side and displays on the client side based on the expected logic.
If you are looking for a job related to Core PHP, you need to prepare for the 2023 Core PHP Interview Questions. It is true that every interview is different as per the different job profiles. Here, we have prepared the important Core PHP Interview Questions and Answers, which will help you get success in your interview.
Start Your Free Software Development Course
In this 2023 Core PHP Interview Questions article, we shall present the 10 most important and frequently asked Core PHP interview questions. These interview questions are divided into two parts as follows:
Part 1 – Core PHP Interview Questions (Basic)This first part covers basic Core PHP Interview Questions and Answers.
Q1. Two very common functions used in core PHP for a long time. Those functions include () and require(). Please give some clear differences between including and requiring a function for core PHP.Include() and require() are both used to include some specific file with the requesting page.
The main difference between them is:
If the developer use requires to include the file, then somehow the process throws some fatal error during execution for unavailability of the file, then execution of the process will entirely stop. But if the developer use includes for including the file, then the entire process will not stop; it will ignore the fatal error and go for executing the next step without stopping the process.
Q2. Suppose we are willing to get the IP address for some client who is using PHP developed web application. Please explain how we can get that IP information in PHP?There have several options for fetching IP addresses of the client execution machine in PHP. The developer can able to write some critical scripts for fetching those data externally.
But one of the popular and very basic approaches to fetching IP addresses is:
$_SERVER[“REMOTE_ADDR”];
Q3. Explain in detail the difference between the two popular functions of PHP, unset() and unlink().The main difference between them is:
If the developer used unset() on any file, then that file reference is going to be undefined for the entire application, whereas if the developer mentions one file as unlink, then that file will be removed from the directory and as well as not available for the entire application.
Q4. There are several error types available in PHP. Explain some of the major error types which are very frequently used for PHP applications and give the proper difference of them.There is the common Core PHP Interview Questions asked in an interview. Several responsibilities normally need to follow by a Core PHP tester in the current IT industry.
Normally in PHP, we are handling three kinds of errors:
Notices: This is just given one notice of wrong coding or execution. It is a very simple and mostly non-critical error that normally occurred script execution time. Suppose an application trying to access some undefined variable; then this kind of notice will come.
Warnings: It is again not that much critical error, but still, any wrong execution warning will be given without stopping the normal execution of the process. An example is, including a function used, but some file is missing in the directory, then the warning will be given, but the process will execute successfully.
Fatal: This is one of the most important errors that came in PHP script execution. It mainly causes the termination of the process by giving a proper explanation. An example is, trying to access some nonexistent object or requiring file uploading, but the file is missing.
Q5. Explain in detail about the difference between GET and POST in the PHP application.Some of the key differences between GET and POST in PHP are given below:
GET information always passes through a URL, so it is always visible to everyone, whereas POST information is embedded with the request and sometimes it is in the encoded format, so it will not able understandable or visible to the normal user.
GET have some restriction on handling the request, define characters are 2048. Whereas POST doesn’t have this kind of restriction at all.
GET only allows require ASCII data, whereas POST does not have this kind of restriction.
Developer common approach to use Get for fetching data, whereas POST is used for inserting or updating.
Part 2 – Core PHP Interview Questions (Advanced) Q6. Suppose the developer needs to enable some of the error-reporting utilities in PHP. How can it be done, please explain in detail.Displaying an error message is one of the key requirements, especially in debugging the developer’s error; it normally displays the number of lines of the script where a fatal error got generated. The developer can display this error on the possible page by giving the below command:
error_reporting(E_ALL)But for initializing or activating of displaying error in PHP application, the developer needs to follow any of the below approaches:
Display_error = ON in php.ini
Ini_set(‘display_error’, 1) in the specific script file
Q7. Explain in detail about Traits in the PHP application.Traits are one of the popular mechanisms specifically for the PHP developer. This mechanism help the developer for allowing to create some reusable code again for the PHP language application in case of those objects where the inheritance objective is not fully supported. In the case of Traits, not possible to inheritance by its own mechanism. It is one of the key requirements that PHP developers should know about the key and powerful features of the language before starting development in PHP.
Q8. Suppose one constant has been defined in one of the PHP scripts. Now developer needs to change that constant value during the execution. Is it possible to do? Explain?If one value is declared as constant in PHP, then it will never be changed by any process during execution. Therefore, a constant value needs to be assigned at the time of initialization.
Q9. Is it possible to extend one class that is defined as final? Explain?There are the most popular Core PHP Interview Questions asked in an interview. Some popular test cases in the current IT industry. If the developer defines one class as final, then extending that class is absolutely not possible. If one class or method is declared final then creating a child class and method overloading or overriding both are not possible.
Q10. Explain in detail about _destruct(), and _construct() methods available in PHP classes.Every PHP object should have two methods called constructor and destructor. Both methods are mainly defined in the build-in. The constructor method is normally called immediately after creating one new instance of the specific class, normally used for initializing all the properties of a class. Whereas the destructor methods are mainly used to release the object of the class from the application memory. The destruction method does not require passing any parameter.
Recommended ArticlesThis has been a guide to Core PHP Interview Questions. Here we have listed the most useful 10 interview sets of questions so that the jobseeker can crack the interview with ease. You may also look at the following articles to learn more –
How Sha1() Function Works In Php With Examples
Introduction to PHP sha1()
PHP sha1() function is a very important function as part of PHP as it is a backed server-side scripting language that needs more emphasis on the security terms. PHP sha1() deals with the security and hashing function which calculates and computes a value of SHA-1 of the hash of the string. Internally PHP sha1() makes use of a subtype of the US Secure Hash Algorithm 1. Sha1() function produces a hash string with a value of 160 characters and then when this hash string is given as an input to the function it produces an output which is a highly secured message digest.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
Syntax sha1(string, raw)Explanation: sha1() function makes use of two types of arguments like string and raw which is used for generating the string and calculating the length of the string with some value. raw is another argument or parameter which is optional in the sense if specified with the sha1() function then it passes the parameter with an optional value such as true or false and then it passes the remaining value to specify and describe the hex or binary value output format. If the optional value appears to be Raw 20 then it is a 20-character binary format otherwise it Is Default 40-character hex number with some specific value.
How does sha1() function work in PHP?The SHA-1() function makes use of the US-Secure hash algorithm1 which is used in a way where the string is given as an input and then a message digest is given as an output. Input is fed to the signature algorithm which checks and verifies for the signature of the message. If a signature message is used as an input rather than the actual message, then it has a high chance of improving the efficiency of the overall algorithm.
This process will optimize and compress the message input and message output functionality compared to the normal hash string message as an input to the signature algorithm. Further if this algorithm is used by the verifier then a digital signature can be used by the creator of the digital signature.
sha_file() function is another subcomponent of the sha1() function which uses the hash of the file function.
This file function of the file name is used to calculate the hash of a file and one raw output will be given to it which will be used to return the message or the string with a value of whether true or false. Md5() algorithm within the function and crc32() with the function will also be used to generate the polynomial of the string. And will help in generating a more secured string with some refined digital signature.
Examples to Implement PHP sha1() FunctionBelow are mentioned the examples:
Example #1his program represents the calculation of the SHA-1 hash of the string after passing one string value to get the hash of the string.
Code:
<?php $str = "welcome to educba"; echo sha1($str);Output:
Example #2This program represents the calculation of the SHA-1 hash of the string after passing one string value to get the hash of the string and then it prints the value of the sha1 string as shown in the output. The input of the string is given as “Welcome to Educba” and the output shows the string value.
Code:
<?php $str = "Welcome to Educba"; echo "The string: ".$str."n"; echo "TRUE - Represenation of Raw 20 character of binary format: ".sha1($str, TRUE)."n"; echo "FALSE - representation of 40 character of hex number: ".sha1($str)."n";Output:
Example #3This program represents the calculation of the SHA-1 hash of the string after passing one string value to get the hash of the string and then it prints the value of the sha1 string as shown in the output. The input of the string is given as “Welcome to Educba” and the output shows the string value. Followed by a test of the input string being fed as an output.
<?php $str = "educba"; echo sha1($str); if (sha1($str) == "49108e13b1505cd6147054cfd07fb52f4c9d2641") { echo "n!educba"; exit; }Output:
Example #4This program is also a part of the sha1() function associated function of CRC 32 algorithm which takes a string “Hello World ” as input and then echoes the value without and with the string of % u value as shown in the output.
Code:
<?php $str = crc32("Hello educba!"); echo 'Without %u: '.$str."n"; echo 'With %u: '; printf("%u",$str);Output:
Example #5This program makes use of the password_hash function as part of the sha1() function and helps in generating the password_hash with an output value as shown and makes use of hashing function by putting the cost parameter as 12 to get the optimized message digest as the final output to optimize and increase the overall efficiency of the program.
Code:
<?php $options = [ ]; echo password_hash("educba_is_a_laerning_portal", PASSWORD_BCRYPT, $options);Output:
Example #6This program makes use of the hash () function to generate the message digest of the given function which will be further used to convert into a digital signature for optimization.
Code:
<?php function lion($data = "", $width=182, $rounds = 4) { return substr( implode( array_map( function ($h) { return str_pad(bin2hex(strrev($h)), 16, "0"); }, str_split(hash("tiger192,$rounds", $data, true), 8) ) ), 0, 48-(192-$width)/4 ); } echo hash('tiger192,3', 'a-string'), PHP_EOL; echo lion('a-string'), PHP_EOL;Output:
Example #7This program illustrated the md5 algorithm to be fed as an input string which is also counted as one of the complementary parts of the sha1() algorithm.
Code:
<?php $str = 'apple'; if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') { echo " i want to have a green or red apple?"; }Output:
Conclusionsha1() function is a part of PHP string references which includes a lot of security and cryptographic algorithms which is very necessary for the backend services and the servers for continuing the overall security breaches related issues and password and user management related data as secured.
Recommended ArticlesThis is a guide to PHP sha1(). Here we discuss an introduction, Syntax, and working of sha1() in PHP along with different examples and code implementation. You can also go through our other related articles to learn more –
How To Install The Latest Version Of Krita In Ubuntu
You’ve updated and upgraded your Ubuntu installation, but Krita remains in its pre-4.3 version. That’s because Ubuntu’s official repositories don’t offer the latest and greatest from Krita’s developers. Let’s see how to install the latest version of Krita on Ubuntu.
Via SnapIt’s a well-known fact that Ubuntu’s latest version prioritizes snap over apt. Although apt insists on installing a pre-4.3 version of Krita, the latest one is available through snap. Terminal fans can install it with:
sudo
snapinstall
kritaThose who prefer the visual way of doing things can bring it on-board through Ubuntu’s Software Center. Start by running the software center app, then typing Krita’s name in the top search field.
Via AppImageKrita’s developers also offer their much-beloved graphics application in AppImage format. It’s almost as easy to install and use as the snap version but requires you to go over a series of steps until you can use it. Plus, you will have to update it manually in the future. Still, this is probably the most familiar way of installing software for former Windows users.
When the process completes, open the folder containing the downloaded file in your file browser.
If you have difficulty executing it, you can make use of the traditional way to make it executable. Open a terminal and type the following command:
Via AptKrita’s latest version might be missing from Ubuntu’s official repositories, but you can still access it via the developer repository.
Start by adding the third-party repository to Ubuntu’s list:
sudo
add-apt-repository ppa:kritalime/
ppaAcknowledge any prompt which may appear. After you have done so, update Ubuntu’s software list with:
sudo
apt update
Finally, install it with a typical:
sudo
apt
install
kritaWith the latest version of Krita installed in your computer, it is now time to sketch like a pro with Krita. If Krita is not to your liking, you can also check out some of the best image-editing software for Linux here.
Odysseas Kourafalos
OK’s real life started at around 10, when he got his first computer – a Commodore 128. Since then, he’s been melting keycaps by typing 24/7, trying to spread The Word Of Tech to anyone interested enough to listen. Or, rather, read.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.
What’s Windows 10 October 2023 Update (Version 1809), And Why You Should Upgrade?
Windows 10 October 2023 Update (version 1809) is the next big feature update for the operating system. “October 2023 Update” is just the friendly marketing name that Microsoft will be using for the release, but it’s technically version 1809.
The October 2023 Update is simply another update, but unlike those patches that release every month, this release delivers a set of new features and improvements. However, they’re not as significant as the ones found in the April 2023 Update (version 1803).
The new feature update for Windows 10 is expected to release sometime in October 2023, and it’ll be offered as a free upgrade for devices already running the operating system.
Microsoft will be rolling out version 1809 gradually, meaning that no every device will get the update the same day. Instead, only computers known to support the new version will get it first. When the update has been tested even further, and there aren’t blocking bugs, the company will continue the rollout to other devices.
If your computer isn’t seeing the October 2023 Update automatically, chances are the reason is that the update isn’t compatible with your device just yet. This is one of the reasons, it’s not recommended to force a new version of Windows 10, unless you know exactly what you’re doing, and you understand the risks.
Windows 10 October 2023 Update version numberFollowing the same version scheme as previous versions, this new release will be known as “Windows 10 version 1809,” which indicates the year and month of the release — even though, the update may end up rolling out the month after.
Windows 10 October 2023 Update installationAs soon as the “October 2023 Update” arrives, and it’s compatible for your device, you’ll receive a notification from Windows Update to install version 1809 as a regular update (but it’ll take longer to install).
If you can’t wait until it becomes available automatically, it’s possible to update using the Media Creation Tool and Update Assistant. You can also download the Windows 10 version 1809 ISO file if you want to take that path (when available).
Windows 10 October 2023 Update reasons to upgradeAlthough it’s recommended to install a new version of Windows 10 because of its new features, you also want to upgrade to get the new improvements and security enhancements to keep your device and data safe and secure.
In this new version, Windows 10 will introduce a new set of features and changes to improve productivity, performance, and security.
This update is much smaller than the first semi-annual update of 2023, but you’ll get a number of good features. Perhaps the two more significant additions in Windows 10 version 1809 is the new clipboard experience that uses the cloud to sync your content across devices, and the ability to view your clipboard history and pin those items you paste frequently.
The second biggest addition is the new dark theme for File Explorer, context menu, and popup boxes.
Alongside these new features, you’ll see other additions and improvements, such as Screen Sketch (Snip & Sketch), which is a new app that replaces the old Snipping Tool to take screenshots on Windows 10.
You can now free up space automatically by allowing Storage Sense to make OneDrive files that you don’t use available only online.
The option to change the system font size is back to Windows 10, and the search experience has been updated with a wider interface to accommodate previews in the right pane to access more information and actions a lot faster.
Also, Microsoft brings its SwiftKey technology to the desktop to offer better autocorrections and predictions when using the touch keyboard, and the update introduces type insights to help you improve your typing more efficiently letting you see stats for auto correcting your spelling mistakes, prediction of the next word you would type, and word suggestions.
Starting with version 1809, Windows 10 includes a new update logic to accurately predict when is the right time to restart the device when there’s an update pending.
You can learn more about all the new features and improvements coming this year in this guide.
Windows 10 October 2023 Update block automatic installAlthough the Windows 10 October 2023 Update is meant to improve the overall experience, new releases are known to have bugs and many problems during the initial rollout. (Though, Microsoft has been getting somewhat better on releasing stable updates.)
If you want to avoid possible errors and other issues, it’s always a good idea to defer Windows 10 feature updates for at least a month or two until you know for sure the update is stable and working correctly. However, if you’re planning to install the new version as soon as it’s available, follow this guide to upgrade without problems.
Update the detailed information about Upgrade Php Version To Php 7.4 On Ubuntu on the Hatcungthantuong.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!