Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Oct 092009
 

Should I always use single-quotes for PHP strings?

Answer:

Some people say single-quotes string is faster than double-quotes string in PHP. But this have been rejected by the PHP's developer

Benchmarks run against PHP 5.2 and 5.3 show that parsing double-quoted 
strings with interpolation is no slower (and often faster) than single- 
quoted strings using concatenation. When simple strings with no 
variables in them are used, the performance is clearly better with 
double-quoted strings due to implementation details in the engine. See 
the benchmark posted at . 

Reference: http://groups.google.com/group/make-the-web-faster/browse_thread/thread/ddfbe82dd80408cc?pli=1

Aug 262009
 

How to check all the commands executed in a Linux server?

Answer:

The short answer is no.

But it might be possible by looking at the .bash_history under the user folder, but keep in mind that user can clear their history by using "history -c" command, or they can delete the file manually.

If you want to force logging on all user, what you need is called "process accounting".

See a more comprehensive howto: http://tldp.org/HOWTO/Process-Accounting/

Jun 022009
 

How to compile APC module for PHP

Answer:

The following steps works in RHEL/CentOS

1. Download the latest APC from PECL

wget http://pecl.php.net/get/APC

2. Extract the APC source package and compile/install it

tar -xvf APC
cd APC-X.X.X (replace with your downloaded version)
phpize
./configure
make && make install

3. Enable APC in PHP configuration

echo "extension=apc.so" > /etc/php.d/apc.ini

4. Restart the httpd and use phpinfo() to verify if APC is running