Language Selection

English French German Italian Portuguese Spanish

PHP Leftovers

Filed under
Development
  • How to install the Hestia Control Panel for an Apache/NGINX PHP-FPM web-based config tool - TechRepublic

    If you're a web admin and you're looking to make your job a bit easier, you probably have your eyes on a control panel. Such tools are generally web-based GUIs that make your job considerably easier. You might have a fine grasp on the command line tools necessary to get the job done, but having a GUI makes your work more efficient.

    On top of that, when you assign tasks to lesser admins, you can be sure you find them staring at the screen, wondering what to do next.

  • Use of usleep() Function in PHP

    Two functions are mainly used in PHP to delay the execution of the script for some time. These are usleep() and sleep(). The usleep() function is used to delay the execution of the script for specific microseconds. This function can throw an exception if the negative microseconds value is provided. This function consumes the CPU cycle also when called. How this function can be used in PHP has shown in this tutorial.

  • Write into a file in PHP using fwrite()

    Many built-in functions exist in PHP to write in a new file or into the existing file. fwrite() function one of them to write content into the file. fopen() and fclose() functions are required to write content into the file using fwrite() function. fopen() function is used to open a file for reading, writing, and appending that returns a file handler. fwrite() function uses the file handler to write the content in the file. fclose() function is used to close the file that has opened for reading or writing and release the buffer that is used by the file. How the content can be written into a new or an existing file using the fwrite() function has been explained in this tutorial.

  • Change the string into uppercase in PHP

    PHP has many built-in functions to change the case of the string. The string value can be converted into all uppercase or lowercase; convert the first letter of the string into the uppercase or lowercase, and convert the first character of each word of a string into uppercase. strtoupper(), ucfirst(), and ucwords() functions are used to change the case of a full string or a part of a string into the uppercase letter in different ways. The uses of these functions have been explained in this tutorial by using different examples.

  • Generate a random number in PHP

    Generating a different number every time by executing the script is called the random number. The random number can be used for various purposes in the programming, such as generating a random filename, random password, and a random number that is not predictable to others. PHP has many built-in functions to generate random numbers in different ways. rand(), random_int(), and mt_rand() functions are used in PHP to generate random numbers. How these functions is used to generate the random numbers are explained in this tutorial.

  • How to install Xdebug and use it in PHP on Ubuntu?

    When any programming code generates unexpected output, it requires to find out the reason behind the error of the output to solve the problem. Debugging is the best way to find out the reason for the unexpected output of the code by tracing the code step by step.

    Normally, print_r() and var_dump() functions are used to check the output of the variables. Xdebug extension is used in PHP for an advanced level of debugging. This extension is not installed in PHP by default. You have to install it and set up the necessary configurations to use its features. How the Xdebug extension can be installed and configured in PHP and integrated with the Visual Studio Code editor on Ubuntu is shown in this tutorial.

  • Use of XOR operator in PHP

    Different types of operators exist in PHP to perform logical operations. These are AND, OR, NOT, and XOR. These operators are used as a Boolean operator and bitwise operator. This tutorial mainly focuses on the Use of the XOR operator. The full form of XOR is exclusive, OR that works on two conditions. The XOR operator returns true when any condition returns true and returns false when both conditions return true or false. Xor keyword is used between the states to perform Boolean Xor operation, and ‘^’ symbol is used between the operands to perform bitwise xor operation. How the xor operator can be used for Boolean and bitwise operation, have shown in this tutorial.

  • Use of xpath() in PHP

    XML document is used to store a small amount of data, and sometimes it is required to read the particular content of XML document based on the path value using PHP script. xpath() function is used to parse the content of an XML document. This function can be used by using simplexml_load_file() function or by creating the object of SimpleXMLElement class. The xpath() function can be used to read the particular XML node values shown in this tutorial.

  • Use of ternary operator in PHP

    If-else statements are normally used to define conditional statements in any programming language. ternary operator(?Smile can be used as the alternative of any simple if-else statement. It is one of the shorthand comparison operators in PHP and contains three operands: the conditional statement, the statement for true condition, and the statement for the false condition. This operator is better implemented with a simple logical statement with a short code because it is better to maintain and can be defined in a single statement. The uses of this operator are explained in this tutorial.

  • Use of usort() function in PHP

    Many built-in functions exist in PHP to sort the array variables. usort() function is one of them. This function sorts the array by using a user-defined callback function. When the array contains a particular type of data that can’t be sort in a standard way by using other sort functions, then usort() is better to use. For example, if the array contains data values, then the variety can’t be appropriately sorted using other sort functions of PHP. This type of collection can be sort by defining the proper user-defined function called in the second argument of the usort() function how usort() function can sort the specific array values shown in this tutorial.

More in Tux Machines

digiKam 7.7.0 is released

After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release. Read more

Dilution and Misuse of the "Linux" Brand

Samsung, Red Hat to Work on Linux Drivers for Future Tech

The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world. Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility. Read more

today's howtos

  • How to install go1.19beta on Ubuntu 22.04 – NextGenTips

    In this tutorial, we are going to explore how to install go on Ubuntu 22.04 Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions. Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection. In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04. Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

  • molecule test: failed to connect to bus in systemd container - openQA bites

    Ansible Molecule is a project to help you test your ansible roles. I’m using molecule for automatically testing the ansible roles of geekoops.

  • How To Install MongoDB on AlmaLinux 9 - idroot

    In this tutorial, we will show you how to install MongoDB on AlmaLinux 9. For those of you who didn’t know, MongoDB is a high-performance, highly scalable document-oriented NoSQL database. Unlike in SQL databases where data is stored in rows and columns inside tables, in MongoDB, data is structured in JSON-like format inside records which are referred to as documents. The open-source attribute of MongoDB as a database software makes it an ideal candidate for almost any database-related project. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB NoSQL database on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.

  • An introduction (and how-to) to Plugin Loader for the Steam Deck. - Invidious
  • Self-host a Ghost Blog With Traefik

    Ghost is a very popular open-source content management system. Started as an alternative to WordPress and it went on to become an alternative to Substack by focusing on membership and newsletter. The creators of Ghost offer managed Pro hosting but it may not fit everyone's budget. Alternatively, you can self-host it on your own cloud servers. On Linux handbook, we already have a guide on deploying Ghost with Docker in a reverse proxy setup. Instead of Ngnix reverse proxy, you can also use another software called Traefik with Docker. It is a popular open-source cloud-native application proxy, API Gateway, Edge-router, and more. I use Traefik to secure my websites using an SSL certificate obtained from Let's Encrypt. Once deployed, Traefik can automatically manage your certificates and their renewals. In this tutorial, I'll share the necessary steps for deploying a Ghost blog with Docker and Traefik.