Upload Share and Earn

Friday, August 24, 2007

PHP Jobs

Hai

I got this Mail saying that there is a php opening in there company

ravi.kiran from Hyderabad

"We need PHP programmers with CMS, ECommerce, community sites experience. We also need action scripting, CSS, Ajax, Flash, web designing experts. Exp 1-3 years. Send your resumes to hai2ravikiran@yahoo.com"

Thank you

Smarty template engine

Smarty template engine frame work for php which execurtes php scripts faster

for more info see this official website
for smarty

Smarty Info

For Smarty Documentation Download

Documenattaion download


All the best

Wednesday, August 22, 2007

How to create a php upload progress meter

By Justin Silverton
This progess meter is based on the yahoo user interface library and alternative php cache (APC). You will need both of these for it to display properly. PHP 5.2.0 or higher is also required. (I have written a previous article on alternative PHP cache here).
The yahoo user interface library can be found here.
How it works
Once APC is installed and configured, the following needs to be added to your php.ini:
apc.rfc1867 = on
Aside from the Yahoo libraries, this is what makes the progress meter possible using php.
This is called the File Upload Progress hook handler and it is only availableif you compiled APC against PHP 5.2.0 or later. When enabledany file uploads which includes a field called APC_UPLOAD_PROGRESS before the file field in an upload formwill cause APC to automatically create an upload_user cache entry where is the value of the APC_UPLOAD_PROGRESS form entry













Download
Demo can be found here

Source can be found here



How to install Alternative PHP Cache





By Justin Silverton
What is APC cache?
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.
Installing
APC Cache is not included with the latest release of php (although it is planned on being included with version 6). It says on the main PHP website that the .dlls can be downloaded from the pecl extensions package, but after downloading and extracting it, I realized that it is not there. I have found the correct .dlls and other files that are needed and they can be download from my server here.
After downloading and extracting the above zip file, complete the following steps:
1) copy the proper php_apc.dll (depending on your version) into your php extensions directory
2) add the following to your php.ini: extension=php_apc.dll (this should be placed under the other extension lines)
3) add the following to your php.ini:
apc.shm_segments=1apc.optimization=0apc.shm_size=128apc.ttl=7200apc.user_ttl=7200apc.num_files_hint=1024apc.mmap_file_mask=/tmp/apc.XXXXXXapc.enable_cli=1
Note: APC needs a temp path to exist, and be writable by the web server. It checks TMP, TEMP, USERPROFILE environment variables in that order and finally tries the WINDOWS directory if none of those are set.
4) copy apc.php (included with the .zip file) to directory on your web server and launch it.
You should see the following:















APC Cache options
Here is some more information about the various options that can be used to setup apc cache.
apc.enabled This can be set to 0 to disable APC. This is primarily useful when APC is statically compiled into PHP, since there is no other way to disable it (when compiled as a DSO, the zend_extension line can just be commented-out). (Default: 1)
apc.shm_segments The number of shared memory segments to allocate for the compiler cache. If APC is running out of shared memory but you have already set apc.shm_size as high as your system allows, you can try raising this value. (Default: 1)
apc.shm_size The size of each shared memory segment in MB. By default, some systems (including most BSD variants) have very low limits on the size of a shared memory segment. (Default: 30)
apc.optimization The optimization level. Zero disables the optimizer, and higher values use more aggressive optimizations. Expect very modest speed improvements. This is experimental. (Default: 0)
apc.num_files_hint A “hint” about the number of distinct source files that will be included or requested on your web server. Set to zero or omit if you’re not sure; this setting is mainly useful for sites that have many thousands of source files. (Default: 1000)
apc.ttl The number of seconds a cache entry is allowed to idle in a slot in case this cache entry slot is needed by another entry. Leaving this at zero means that your cache could potentially fill up with stale entries while newer entries won’t be cached. (Default: 0)
apc.user_ttl The number of seconds a user cache entry is allowed to idle in a slot in case this cache entry slot is needed by another entry. Leaving this at zero means that your cache could potentially fill up with stale entries while newer entries won’t be cached. (Default: 0)
apc.gc_ttl The number of seconds that a cache entry may remain on the garbage-collection list. This value provides a failsafe in the event that a server process dies while executing a cached source file; if that source file is modified, the memory allocated for the old version will not be reclaimed until this TTL reached. Set to zero to disable this feature. (Default: 3600)
apc.filters A comma-separated list of POSIX extended regular expressions. If any pattern matches the source filename, the file will not be cached. Note that the filename used for matching is the one passed to include/require, not the absolute path. If the first character of the expression is a + then the expression will be additive in the sense that any files matched by the expression will be cached, and if the first character is a - then anything matched will not be cached. The - case is the default, so it can be left off. (Default: “”)
apc.enable_cli Mostly for testing and debugging. Setting this enables APC for the CLI version of PHP. Normally you wouldn’t want to create, populate and tear down the APC cache on every CLI request, but for various test scenarios it is handy to be able to enable APC for the CLI version of APC easily. (Default: 0)
apc.max_file_size Prevents large files from being cached. (Default: 1M)
apc.stat Whether to stat the main script file and the fullpath includes. If you turn this off you will need to restart your server in order to update scripts. (Default: 1)
apc.write_lock On busy servers when you first start up the server, or when many files are modified, you can end up with all your processes trying to compile and cache the same files. With write_lock enabled, only one process at a time will try to compile an uncached script while the other processes will run uncached instead of sitting around waiting on a lock. (Default: 1)
apc.rfc1867 RFC1867 File Upload Progress hook handler is only available if you compiled APC against PHP 5.2.0 or later. When enabled any file uploads which includes a field called APC_UPLOAD_PROGRESS before the file field in an upload form will cause APC to automatically create an upload_ user cache entry where is the value of the APC_UPLOAD_PROGRESS form entry. (Default: 0)
The offical PHP manual page can be found

SRC:http://www.whenpenguinsattack.com/category/php/page/7/

Monday, August 20, 2007

PHP MSSQL connecting script and function

WE can connect to MSSQL database by using PHP. To connect to MsSQL we have to enable the MsSQL extension support inside php.ini file. For this we have to uncomment the line saying
extension=php_mssql.dll The status of the MSSQL support can be checked by using phpinfo function.
To check the PHP support for MSSQL we can use the function phpinfo(). To enable MSSQL support we have to uncomment the this line inside php.ini file. extension=php_mssql.dll If the support exists then you will get the details like this below.



Once the support is available we can use different functions to handle data from MSSQL database. Now let us try for connecting to MSSQL database server. Here are the connection steps. Note that we have used one remote db server but same string will work for a local server also.
$dbusername='username';
$dbpassword='password';
$servername='servername';
$link = mssql_connect ($servername,$dbusername,$dbpassword);

Saturday, August 18, 2007

PHP Script Execution Time

You may have seen this feature of some sites around the net. Time execution basically means you can see how long it took for the page to load. This can be helpful when programming, or whenever.
An example of this script:Script Execution Time: 0.001 seconds
Lets say you have a basic HTML page: Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text Just some text
So we'll add the time execution script here.
The basic logic behind this is we need to see at what time the script started, and when it ended. After that we just need to find the difference between those two numbers.
To refresh your memory on how time and dates on the internet work, please check out, Playing with Dates.
Instead of using the common mktime() function to get the current timestamp, we'll use the following function to get the micro time. This is because usual execution times are much less then 1 second, so we'll need to use this for more accurate times.
The function we will be using to get the current micro time is this:




?>

That's about it, now you can see how long it takes to load the page.

 
eXTReMe Tracker