Sometimes we need to specify the file charset before writing the data to a file. The data strings which we get from the database are in UTF-8 so we have to convert them in proper charset. This could be done be iconv().
In Drupal, we can use a progress bar when uploading an image or file. But that needs a PHP PECL extension called uploadprogress. The following steps work for Ubuntu Precise (Ubuntu 12.04.1 LTS).
Memcached is a distributed memory caching system and it caches data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.
APC stands for Alternative PHP Cache is a opcode which also known as machine code. The opcode is cached such that every time a request is sent to server, the same opcode is used until it detects a change in the PHP file.
Update @ 2013-05-09: I am not very sure if this could really enable the Nginx Microcaching as i couldn’t find the HIT value in the HTTP response. Please feel free to comment and let us know if you got the solution. Thanks. =D
Enable Microcaching in Nginx could help making your website run much faster. Base on the setting we did in Nginx + PHP-FPM on Ubuntu Precise. Let’s edit the VirtualHost configuration file to enable Microcaching. Continue reading Nginx – Enable Microcaching→
I am working on a Hotel Booking website. The booking feature is provided by Hotel Booking System for Ubercart. But this module is not actively maintained so there are some bugs which i have to fix it for myself.
One of the bug is about strtotime(‘+1 month’). Intuitively, you may think you could get a date of next month. But here comes the problem. Assume you are now on 31st Jan. Since February only has 28 days (sometimes 29), strtotime(‘+1 month’) will return 3rd Mar. Continue reading PHP – Get the next month by strtotime→
About one and a half year ago, i published a blog post about adding text to image in PHP. PHP – Add Text on an Image
The above example only display the image in browser, but it would not save the image on the server. Today i would like to show you another example which could save the image with text added on server.
What you need is 3 files.
index.php
kenshin.jpg (The image which you wanna add text on it)