Category Archive: PHP

Il linguaggio di programmazione del Web : PHP

Mar 02

Dynamic bind_param for mysqli update query in PHP

If you need to dynamically bind params to an UPDATE query when you are using mysqli statement you will face some troubles. But few lines far you are going to find the right solution for you $query = ”; $flag = false; $bindParam = ”; $refArray = array(); $refArray[] = &$bindParam; //set the 0 field //Manage …

Continue reading »

Feb 29

Fix PHP blank page and manage errors without server access

If  you have a blank page and you don’t any access to web server log you can use these few lines of code before the your PHP code causing the crash. // Display Errors ini_set(‘display_errors’, ‘On’); ini_set(‘html_errors’, 0); // Error Reporting error_reporting(-1); // Shutdown Handler function ShutdownHandler() { if (@is_array($error = @error_get_last())) { return(@call_user_func_array(‘ErrorHandler’, $error)); …

Continue reading »

Jul 27

Send var_dump result to a string variable with PHP

Maybe you need to capture var_dump result in a variable to use it like a string in you context. You don’t want to output result but just have it in your hand.

Continue reading »

May 17

json_encode(): Invalid UTF-8 sequence in argument and SLIM

Yesterday i stumbled on this error : json_encode(): Invalid UTF-8 sequence in argument . Searching on the net doesn’t resolve the issue but as usual gives me some other point of view to find the solution. Environment I’m using Slim Framework and a Mysqli connection to retrieve data from a MySQL Database, then i want to …

Continue reading »

Feb 08

Howto solve problem Fatal error: Call to undefined function curl_init()

When you set a development environment there are default configurations that don’t meet yours requirements: one of these can be possibility to make use of php curl extension. So you can encounter the error :

Continue reading »

Jan 08

Using .mo and .po file without native gettext php function

If you have followed the article “Setup local translation in PHP using gettext function” and you got in trouble, most probably the problem is around the fact that you don’t have gettext functionality available in you server environment. And now what if you want to take advantage of .mo and .po files and hence of …

Continue reading »

Jan 06

Setup locale translation in PHP using gettext function

Translation in any website can be reached in several ways, but our favorite is using gettext functions provided natively into PHP. If you use some popular CMS like WordPress and you have translated CMS interface, surely you have came in touch with .po and .mo files . These ones are classic gettext file. You could …

Continue reading »

Nov 28

Internal server error when upload image larger 100 kb in Drupal and Plesk

As usually we write in english to let know all people about the error we fixed. When you install Drupal, you have to try upload image like changing your picture profile to test file upload, file system permissions and site visualization. Doing so we encountered the error described in object: Internal server error! It’s really …

Continue reading »

Nov 28

howto enable apc extension in php with Plesk

Simple as one command but not obvious where to put it. Just starting where : in php.ini in /var/www/vhost/domain.name/etc/ . In this directory you will find php.ini, copy and paste : extension=apc.so apc.enabled = 1 You don’t need anything else, don’t restart apache or other tool.

Nov 05

ERROR: `phpize’ failed when installing apc

This article is written in english to help all people encountering the error presented in title. If you try to install apc extension to improve php performance you can come in touch with error phpize failed. The solution is as simple as exec one and only one command. I will not write about apc and …

Continue reading »

Older posts «