Tag Archives: PHP

How To Use PHP-Fast CGI Process Manager On WHM & cPanel Servers?

PHP-FPM (FastCGI Process Manager) is a PHP undertaking that provides an alternative way to run PHP scripts on web servers. The cPanel webhosting VPS, and Dedicated Servers at Sangkrit.net gives you the option to use PHP-FPM on your websites.

It is programmed to improve the performance and efficiency of PHP execution, particularly in the context of serving web applications. In the traditional way of executing PHP scripts, such as the web server like Apache uses a separate process to handle each PHP request which sometimes leads to high memory consumption and inefficiencies, especially while handling multiple concurrent requests. PHP-FPM addresses these issues by managing PHP processes more efficiently.

It offers several benefits over traditional PHP execution:

  1. Performance: PHP-FPM is designed for better performance and resource utilization, making it particularly effective for high-traffic websites or applications.
  2. Resource Efficiency: PHP-FPM pools can be configured to allocate resources more effectively, reducing memory usage and improving server responsiveness.
  3. Process Management: PHP-FPM can manage PHP processes dynamically based on the number of incoming requests. It helps prevent server overload and ensures smooth operation during traffic spikes.
  4. Isolation: PHP-FPM pools isolate each website’s PHP processes, providing better security and stability.
  5. Customization: You can configure PHP-FPM settings, such as the number of child processes, to suit your website’s requirements.

How To Use PHP-FPM On cPanel?

The cPanel webhosting environment at Sangkrit.net gives you the option to enable and configure PHP-FPM for your websites. Here’s how you can do it:

  1. Log in to cPanel: Access your cPanel account using your login credentials.
  2. Find PHP Configuration: In the cPanel dashboard, look for the “MultiPHP Manager” or “Select PHP Version” option. This is where you can manage PHP settings for your domains.
  3. Select PHP-FPM: In the PHP version manager, you’ll see a list of your domains and the currently used PHP version. You can select “PHP-FPM” from the dropdown menu for the domains you want to enable it for.
  4. Configure PHP-FPM: Depending on the cPanel version and your hosting provider’s settings, you might have the option to configure PHP-FPM settings. This could include adjusting the number of child processes, the PHP-FPM version, and other options.
  5. Save Changes: After enabling PHP-FPM and making any necessary configurations, save your changes.
  6. Test: You can now test your website to ensure that PHP-FPM is working as expected. Observe the performance and resource usage.

Keep in mind that PHP-FPM configurations might vary based on the new updates, policies, and the cPanel version being used. So for any kind of online support or specific instructions on enabling and configuring PHP-FPM for your domains simply contact the support team.

Know Whether Your Server’s Memcached Service Is Listening On Port 11211

If you’re not sure whether your dedicated server‘s Memcached service is listening on port 11211 i.e. it is installed and running properly, there are some easy tests you can do to make sure everything is operating fine.

Before you start, enable the administrator access on your server (in case you have not), connect via SSH then switch to the root user.

Next, in the command line, type the following command and PRESS ENTER:

telnet localhost 11211

This will report to you back that it was able to connect to the service.

[root@server[~]: telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

In case, if it’s not installed properly, you will see something like this:

[root@transfer[~]: telnet localhost 11211
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

And you will not be able to connect to the service.

In the next lesson, you will learn about testing the presence of the needed PHP libraries to make Memcached work for you.

Configuring Memcached PHP Libraries On Your Dedicated Server

The dedicated servers at SANGKRIT.net offer you the option to configure your object caching system in the way that suits you best.

The lesson will guide you on how and why configuring Memcached PHP Libraries on your Linux-based dedicated server benefits you.

Memcached is one free object caching system that can be installed on your server for improving the performance of your website. It only works when you install the daemon, install the PHP libraries and configure your PHP application correctly.

You can easily do all that by following these steps:

  1. Login to your SANGKRIT.net account
  2. Visit your My Products page
  3. Click the Servers option
  4. Click Manage
  5. Open WHM

Next, on the WHM panel follow these steps:

  1. From the Software section on the left, select EasyApache 4
  2. Click the Customize button present in the Currently Installed Packages section.
  3. Click PHP Libraries on the left
  4. Type Memcached in the search box
  5. Click the button to install Memcached on the desired versions of PHP
  6. Click the Review button on the left,
  7. Click the Provision button at the bottom of the page

The installation should be complete now.

Apart from this, you should also know that the same modules can also be installed with yum in SSH. But be very conscious about the naming convention i.e. ea-php72-php-memcached. It must be installed on each version of PHP.

The next coming lesson will help you in the process of installing and managing the Memcached Daemon.

Managing Apache & PHP Modules On Your Server

You can install necessary PHP modules for Apache on your VPS and Dedicated Server and then enable them manually.

You can enable, disable, or customize such modules using a tool called EasyApache. By using this tool, the PHP and Apache options are rebuilt on the basis of the options you select.

  1. Login to your SANGKRIT.net account
  2. Visit your My Products page
  3. Click the Servers option
  4. Click Manage
  5. Open WHM

The easiest way to upgrade PHP is through EasyApace which you can find in the software section of WHM:

  1. Lookup for EasyApache using the search box on the left section of WHM
  2. Click to open it then click EasyApache (ApacheUpdate) option
  3. This will open the present time Apache Configuration Profile
  4. Click the gear icon for a customized profile option
  5. You will see Apache wizard guiding you through various steps
  6. Here, select the Apache version
  7. Then, select your PHP versions
  8. Next, from the Short Options List, select the features you like to include in your Apache
  9. You can enable the modules you like to add and you can also disable the modules which you don’t want
  10. For more configuration options you may click the Exhaustive Options List
  11. Finally, select the Save and Build option

In the Exhaustive Options List, you can select or deselect various other modules. There is also an option called Save Only that only saves your profile and doesn’t starts the building process.

To start building you will need to click Save and Build option as explained above. Once you click this option, do not close your browser window and wait for the process to complete.

This may take some time depending on the options you have selected and the power of your server. If you are using a small server with limited resources then you should not enable many options at once and instead enable a few options first and then repeat the process for enabling more modules.

Upgrading PHP On Your Dedicated Server

Before upgrading PHP on your VPS or Dedicated Server, you need to make sure that all applications and websites are compatible with the version of PHP you are switching to.

Next, take a backup of all your websites and apps, then follow the given steps.

  1. Login to your SANGKRIT.net account
  2. Visit your My Products page
  3. Click the Servers option
  4. Click Manage
  5. Open WHM

The easiest way to upgrade PHP is through EasyApace which you can find in the software section of WHM:

  1. Lookup for EasyApache using the search box on the left section of WHM
  2. Click to open it then click EasyApache (ApacheUpdate) option
  3. This will open the present time Apache Configuration Profile
  4. Click the gear icon for a customized profile option
  5. Apache version screen will appear
  6. Select the Apache version you want
  7. Click on the next step button
  8. A screen will appear where you can select the PHP version
  9. Select the PHP version and click the next step button
  10. Follow the next two steps to save, build, and upgrade

The directories you must know:

Directory for the specific references to the PHP directory or extensions:

/usr/local/cpanel/3rdparty/php/version-number/

Directory for the specific references to PHP libraries or extensions:

/usr/local/cpanel/3rdparty/php/version-number/lib

Directory for the specific references to PHP binaries:

/usr/local/cpanel/3rdparty/php/version-number/bin/

Every version of PHP has its own php.ini file which is found in:

/usr/local/cpanel/3rdparty/php/version-number/etc

Every time you edit this file, the changes are not transferred to other PHP versions you upgrade to or switch to. Hence, after an upgrade, you also need to change your php.ini file to match it with your newer version of PHP.

How To Configure PHP Directives On Your Server?

PHP allows you to control different aspects of your websites by using directives in php.ini files. These files contain the default configuration for the operation of PHP applications.

By using PHP directives you can control different variables such as upload size, file timeout, and resource limit, etc of websites running on your hosting, VPS, or dedicated server.

To add or edit a PHP directive – Log in to your SANGKRIT.net account and follow these steps:

  1. Open cPanel of your server or hosting option
  2. Navigate to the File Manager interface via cPanel -> Home -> Files -> File Manager
  3. Make sure that hidden files are visible to you or you can enable them via Settings, by ticking the Show hidden files checkbox option
  4. Navigate to the target directory.
  5. Create a new file – click New File / + File button
  6. Enter .user.ini filename
  7. Click Create New File button
  8. Select the new file from the list of files and click Edit
  9. Now enter the PHP directives you wish to adjust for the present directory
  10. Click the Save button

INI files can be configured on per-directory basis and are processed only by the CGI/FASTCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are running PHP as an Apache module then the .htaccess file will do your thing.

In addition to the main INI file, PHP scans each directory for its INI file. In a case where the PHP file has been kept outside the document root, only its directory is scanned.

How To Update PHP On Your Dedicated Server?

You can reset the version of PHP on your dedicated server and its cPanel sites. Sometimes one version of PHP works for some sites while it doesn’t work for others.

For example: While running WordPress, the recommended PHP version is at least PHP 7 or higher. However, it also runs on some lower versions.

The lesson will guide you how you can update PHP version both server wide and on per domain basis.

To upgrade PHP on your Dedicated Server:

  1. Log in to your SANGKRIT.net account
  2. Open the Products page and click the Servers tab
  3. Click Launch (Next to the account, you want to use)
  4. Click Manage Server (WHM) 
  5. Click Proceed

On your WHM admin page:

  1. Search PHP on left side search box
  2. Click MultiPHP Manager
  3. You will see a list of domains
  4. You can set PHP version per Domain
  5. Select the domains that you wish to change
  6. Apply a PHP version from the list given there

The page also enables you to set a system default PHP version.

Any domain that is set to the inherit value indicates that it does not have its own PHP version explicitly set.

Newer versions of PHP are released with a lot of new improvements. As it progresses, every update is made to make it more secure, less resource hungry, and overall faster than before.

For any more help, simply comment below or use the helpline.

The Filename Your PHP Initialization File Need To Use

PHP initialization files are read when PHP starts up, these files can manage forms, server, and environmental variables as well as server-side cookies, temporary directories, error display, and error logging. The directives these files can control can be found in PHP’s documentation.

Continue reading The Filename Your PHP Initialization File Need To Use

Shardul Pandey Talks To Fahad Mahmood

I welcome you Fahad at SANGKRIT.net, please tell our netizens about yourself, your story. Hi, I am Fahad Mahmood (A WordPress Mechanic) the developer of a few famous WordPress Plugins like Keep Backup Daily, Alphabetic Pagination, jQuery Post Splitter, RSS Feed Widget and a recently launched WordPress Plugin WP Header Images. My journey started from a HTML tag <marquee></marquee> which I learned very first even before <html> and <body>. It was really inspiring for me when text was moving from right to left. As notepad was available everywhere so i did a number of experiments in my college’s computer lab during my ICS session 2001. My interest became a passion when I learned about click event of a button in visual basic 6.0. It was purely a magic when I played with it and successfully changed document title, button text, label captions and text in textboxes.

Continue reading Shardul Pandey Talks To Fahad Mahmood

Code Snippets: Adding PHP Functions & Filters Without Editing Theme Functions File In WordPress

For customizing the default behavior of WordPress, webmasters either use plugins or insert hacks i.e. PHP functions and filters inside activated theme’s function.php file.

This works but when you insert any code without creating a child theme, it gets is automatically washed away in new updates.

Earlier we have discussed about creating child themes, we have also discussed about generating child theme with a user friendly wizard and there is a plugin that allows you to generate child theme of any theme in a click of a button.

Yes, you can easily insert custom PHP function in the functions.php file of your child theme but today in this lesson you will learn about a more easy way of inserting and activating PHP hacks directly from your admin area dashboard.

Continue reading Code Snippets: Adding PHP Functions & Filters Without Editing Theme Functions File In WordPress

Uploading Big Plugin Files From WordPress Admin Area

Default WordPress plugin uploader crashes whenever you try uploading plugin zip files of size exceeding maximum PHP memory. For instance, some default PHP installations have 2MB memory and when you try uploading plugin zip bigger than 2MB, the uploader crashes showing some PHP error.

Continue reading Uploading Big Plugin Files From WordPress Admin Area

Shardul Pandey Talks To Subin, A PHP Programmer & WordPress Developer

Shardul Pandey Talks To Subin, A PHP Programmer & WordPress DeveloperI welcome you Subin at SANGKRIT.net, please tell our netizens about yourself.

My name is Subin. I am a programmer, blogger and a web enthusiast. I blog about programming related subjects, code solutions and the latest tech news. PHP is my favourite language and is a big fan of jQuery JavaScript library. WordPress is my favourite CMS and MySQL is my favourite Database. I create projects, play with code and blog about the problems and solutions I faced in creating projects whether it’s a bug or something else.

At what age what actually brought you up to programming and consequently programming WordPress? Why do you enjoy it?

I started programming when I was 11 years old. I only got into WordPress in 2013 and I created and published my first plugin “Blogger 2 WordPress” in 2014. I enjoy programming, because it relaxes my mind. When I code, I enter into a new world. A world where I forget all my problems in life and focus on the task in hand. Coding makes errors and I try and try to find solutions to those errors. When I find the solution, it is stuck on my mind and I’ll never forget it. Programming is a lot like Maths. You won’t like it first, but when you get around it you will find it enjoyable.

Tell us about the plugins and apps you have created so far?

By far, I have created 2 WordPress Plugins – Blogger 2 WordPress & Code Blocks. Blogger 2 WordPress makes it easy to set redirections from old blogger posts to new WP posts (and pages) after you moved your blog to WP. I have created a lot of web apps. Some of them are online and some of them in localhost. My first online app was Subins which I made it online in 2012. It was just a test app of mine. Nothing serious. I didn’t know much about hacking & cracking when I created it. So, it was vulnerable to Cracking. Soon after 1 year, my friend (Facebook) cracked it. I deleted the data on Subins just a day after it was cracked. Now I’m working on my blog (subinsb.com) and an open source social network called Open (open.subinsb.com). I’m also working on a new project which I can’t say about it now.

Suppose if you were reviewing any new plugin then what are the most important things you look for that indicate a well-designed program?

The most important thing is that the plugin shouldn’t contain any errors. A simple semicolon (;) can make a big error in plugins. Syntax Errors is the main error, plugin developers must notice. Also, plugin developers must make sure the plugin work on almost every versions of the language and server. A well designed plugin will work flawlessly at great speed. If you are running the plugin even on low memory CPUs, it should work well. So there are 3 main factors (maybe more) in a well designed executed plugin :

  1. No Errors
  2. Compatibility
  3. Environment

Your website shows a project section with links to Open & Demos? Tell us about them?

Open is an Open Source Social Network. Anyone can edit the source code of the site. There are no ads, no tracking stuff and anything else on Open. It’s clean, simple and have the ability to post to Facebook & Twitter at one place. Demos is the sub site of my blog. This site contains the demos of the tutorials, code or projects seen on the blog.

You have no Advertisements on your blog? Do you have any plans to go pro in blogging and earn money?

When I started blogging, all I could think about was money ! I placed ads at first. But when I went through the blogging, programming and contributing to Open Source Softwares, I understood that Ads are a distraction to the users. Ads make the site slow too. No one likes ads. So Why put it in a info blog ? Information should be passed free of charge. So, I removed the ads and put on the “Donate” button (subinsb.com/donate). If people really like my content, they will donate. Also, the revenue from ads are low. Google Adsense rejected my application when I had 2 $. That made me angry and it’s also a reason why I’m not putting ads anymore.

How much time you spend working on your domain and writing programs? What philosophy drives you doing this?

When I return home from school and after I finish all the home works and stuff, I turn on the computer and start coding. I make up ideas of posts and projects on the free periods of my school and write it down. Then I do it when I reach home. On holidays, I use the computer from morning to noon (about 2 PM) and from evening (6.30 PM) to night (11.30 or more if I got an error). WP plugins help users to do big tasks with just a plugin. Open Source minded programmers always help people. I’m an open source minded person. WP philosophy “Code Is Poetry” and StackOverflow (http://goo.gl/kCKBGs) helped me into doing this.

How about your parents? Is either of them involved in programming fields?

My parents are normal Kerala persons. My dad is the “Assistant Secretary” of Ayiloor Panchayat, Palakkad, Kerala and my mom is an house wife. She worked as a computer teacher before teaching Windows 98 and stuff. I’m sure that the coding & computer stuff came from my mom. My dad always supported in coding and always made me walk through the right path. He scolds me when I say “I hacked someone / website”. Hacking is wrong and he made me understand about it.

What are you working on today? Any new plugin?

I’m now working on a project like WordPress, but not entirely like it. I can’t say more about it now. When I release my new project, I will certainly invite you. I created about 5-6 plugins. 2 of them WP and others jQuery & PHP. It’s hard to maintain all of them. I’m very very busy in maintaining blog, plugins and school stuff. I will improve my existing plugins and when I get a new idea, I will make another plugin.

Tell us something about your city and your favorite hangout spots there?

I’m from Kerala , a state in India. I’m living in Kunnamkulam, a town (muncipality). Nothing big here. I don’t go out much. But my favourite places are the paddy fields and the streets where I could walk or ride a bicycle peacefully.

What is your ultimate message for netizens?

Never stop working hard. If you work hard, you will certainly accomplish your task. Never copy content from others. Always make your own stuff. Don’t hack / harass any person on the Internet. Always be a good netizen and speak up when you find something illegal or bad behaviour. Never fear. There are millions of nice people in this world who can help you. Don’t hesitate to ask for answers on disucssion forums and Q & A sites (stackexchange.com). Stay safe and simple.

Check CPU Performance Of PHP & MySQL Server Right From WordPress Admin Area

With PHP/MySQL CPU performance statistics WordPress plugin you can check your CPU performance of your PHP and MySQL database time to time right from your WordPress  admin area dashboard.

Continue reading Check CPU Performance Of PHP & MySQL Server Right From WordPress Admin Area

Shardul Pandey Talks To Isabel Castillo, A PHP Programmer

[note color=”#FFCC00″]Interview is ongoing live…[/note]

Shardul Pandey Talks is international program for promoting those individuals, who register their domain to create virtual wealth in webspace so if you too want to get interviewed, simply email to shardulpandey@sangkrit.org considering any conversation upon this as subject to publication here.

Continue reading Shardul Pandey Talks To Isabel Castillo, A PHP Programmer

Serendipity: A PHP & Smarty Based Content Management System For Bloggers

Serendipity is a PHP and Smart (PHP Template Engine) based contnet management system specially for webloggers. Using this application one can easily maintain an online diary, weblog or a complete homepage. Its default package is designed for casual bloggers, It offers you a flexible, expandable and user friendly framework with the power for professional applications.

Continue reading Serendipity: A PHP & Smarty Based Content Management System For Bloggers

Different Ways Of Increasing PHP Memory Limit When Using WordPress

Increasing PHP limit is easy. The most popular method of increasing PHP limit is by editing the PHP.ini file which is present on your site’s root directory. But here are few more menthods you can use for increasing PHP memory limit in your WordPress site.

Continue reading Different Ways Of Increasing PHP Memory Limit When Using WordPress

How To Easily Edit Your PHP.INI File From cPanel ?

What is PHP.INI File ? PHP.INI is a configuration file which is read when PHP starts up. For server module versions of PHP, it only happens once when the webserver is started. For the CGI and CLI versions, it happens on every invocation.

Continue reading How To Easily Edit Your PHP.INI File From cPanel ?

How To Easily Convert HTML Code To PHP Online In Just A Click ?

Its easy to convert HTML code to PHP without hiring any PHP programmer or downloading any application, you can simply do this online free of cost. There are many online free tools that converts HTML to PHP in quick way.

Continue reading How To Easily Convert HTML Code To PHP Online In Just A Click ?