Unique Temporary File Names With PHP

When you work with multiple threads in PHP, you often need to use temporary files. When you have a few files, everything goes well. But when the number of threads is quite big and you need to store your data in temporary files, you may get stuck at this point. A PHP function will save your time by… Read More »

Uncategorized

Counting Number Of Lines in a Big File – Linux Shell Command

Often it is necessary to work with big files, that cannot be viewed using standard editors. For example, If you have a 4Gb file, I think you won’t open it with any text editor. But what if you need to know how many bytes are in this file, of how many strings it contains? There is a linux… Read More »

Uncategorized

Home to Disable PHP Safe Mode and open_basedir in Directadmin

Sometimes you need to remove limits that are automatically added by DirectAdmin. For example, you are not allowed to include files from anywhere but your home directory, you cannot use CURLOPT_FOLLOWLOCATION in php and so on. The first case is the result of open_basedir protection. If you’re not running a hosting service and all sites are yours, it… Read More »

Uncategorized

How To Repair And Optimize All Mysql Databases

When I tried to create admin backup for DirectAdmin, I got the message that one of my MySQL databases has errors and these errors were propagated to my backup. I’d suggest this to DirectAdmin developers, as using a simple command should avoid such errors. There is a linux shell tool called mysqlcheck, that allows to check, repair and… Read More »

Uncategorized

How to Add RAR support to CentOS 4 (Red Hat Enterprise)

Today I had to install rar support to unpack a big file. I’ve tried to download an archive from rarlab site and even unpacked it. Everything seemed to be nice, but when I tried to unpack a file, I faced the following error: unrar: /lib/tls/libc.so.6: version `GLIBC_2.4′ not found (required by unrar) . I’ve searched for an updated… Read More »

Uncategorized

How to Disable Web Access to Account With IP and Username in Directadmin

Sometimes it is necessary to disable http://ip/~username account access for any reason. Site can be unavailable or simply you don’t want users to access it in such a way. There is a simple directive in httpd.conf that will stop it. Just find the following lines and make them the same as below: <IfModule mod_userdir.c> #UserDir public_html UserDir disabled… Read More »

Uncategorized

Finding Difference Between Two Files with PHP

Today I will show you a short and effective solution to “minus” one file from another. The first solution uses PHP’s array_diff function and is useful when your files are not too big as this method consumes server RAM if you create big arrays. Here is the code: <? $file1=file(“plus.txt”); $file2=file(“minus.txt”); $hopa=array_diff($file1, $file2); ?> $hopa is the array… Read More »

Uncategorized

Monitoring Your Site Uptime With FREE Online Services

Your site uptime is a very important criteria of web server administrator’s qualification. Most hosting service providers promise 99,9% uptime and it is often true, but you are always welcome to check it by yourself. I will tell you about two online services I like and I highly recommend to use this kind of online service. It is… Read More »

Uncategorized

How to Find Your php.ini file location

Often you need to make changes to your php.ini file. If you run locate php.ini, you will find some files, but this search won’t guide you to the correct one. You need one php.ini file that is used by current server configuration. Only changes that are applied there will be propagated to your php configuration. But how to… Read More »

Uncategorized

Checking The Number Of Running PHP Script Copies

Sometimes you need to run several copies of one script and need to know the number of such processes. There is a simple script that allows to easily count the number of script copies with the only limitation: dcript filename should be the same and it should be run using PHP CLI as the script uses grep tp… Read More »

Uncategorized