Posts Tagged ‘php’

sqlite version 2.8.x and PHP 5.2.x

Thursday, August 21st, 2008

It seems straight forward if you read the PHP manual …. just do a pecl install sqlite …. but most things in live is not that simple. :( The above command gave me the following error:

../SQLite-1.0.3/sqlite.c:56: error:
‘BYREF_NONE’ undeclared here (not in a function)
../SQLite-1.0.3/sqlite.c:56: error:
‘BYREF_FORCE’ undeclared here (not in a function)
../SQLite-1.0.3/sqlite.c:125: warning:
initialization from incompatible pointer type
../SQLite-1.0.3/sqlite.c:126: warning:
initialization from incompatible pointer type
make: *** [sqlite.lo] Error 1
ERROR: `make’ failed

Thanks to a post I found on, I can post the solution below:

PHP 5 is compiled with “–without sqlite”.

Start with installing php-pecl-sqlite

$ pear download sqlite
$ wget -q

then unpacked and began to compile it

$ tar zxvf SQLite-1.0.3.tgz
$ cd SQLite-1.0.3
$ phpize
$ ./configure
$ make

make failed here with some offset error

edit sqlite.c, comment out the following line:
/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */

And then change these lines

function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, arg3_force_ref)
PHP_FE(sqlite_popen, arg3_force_ref)
function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, third_arg_force_ref)
PHP_FE(sqlite_popen, third_arg_force_ref)

$ make
$ make install
$ service httpd restart

PHP 5.2.5 and Plesk 8.1.x and Plesk 8.2.x …

Monday, December 10th, 2007

Oops, the latest version of PHP breaks a few things on Plesk 8.1.x and Plesk 8.2.x installations. It propably affects other installations as well, but I stopped testing since I was only interested in Plesk 8.2.x and later.

According to atomicrocketturtle the problem will be fixed in Plesk 8.3. We will just have to wait and see.

On rackerhacker‘s blog I found a very elegant solution to the problem that was provided by Kevin M.

I repeat the entry from rackerhacker‘s blog:

There’s a few issues with PHP 5.2.5 and the version of Horde that is bundled with Plesk 8.1.x and 8.2.x. The PHP include paths that appear in the Apache configuration generated by Plesk conflict with the PHP installation, and that causes the Horde webmail interface to segmentation fault.

To fix the problem, create a file called /etc/httpd/conf.d/zz050a_horde_php_workaround.conf and put the following inside it:

<DirectoryMatch /usr/share/psa-horde>
php_admin_value include_path "/usr/share/psa-horde/lib:/usr/share/psa-horde:/usr/share/psa-horde/pear:."

Reload the Apache configuration and your Horde installation should work properly with PHP 5.2.5.

Running suPHP and mod_php side by side on Plesk

Sunday, May 14th, 2006

By default all the Plesk servers runs mod_php for speed. This has one major drawback and that is that if a clients creates files via PHP, they are owned by the webserver user under which mod_php runs. The solution to the problem seems to enable suPHP for the clients that needs to create files via PHP.

Below is the procedure that I found to work:

  1. Download the mod_php RPM from the Dag Wiers repository:


  2. Install the mod_php RPM:

    rpm -Uvh mod_suphp-0.6.1-2.1.el3.rf.i386.rpm

  3. Disable able the mod_suphp AddHandler in /etc/httpd/conf.d/suphp.conf
  4. Your /etc/httpd/conf.d/suphp.conf, should only have the following lines:

    LoadModule suphp_module modules/
    LoadModule php4_module modules/
    suPHP_Engine off

    Putting the above into your config will default to PHP pages being run by mod_php.

  5. To switch a virtual host over to mod_suphp, use the following:

    <Directory /home/httpd/vhosts/<VHOST>/httpdocs>
    <IfModule sapi_apache2.c>
    <IfModule mod_suphp.c>
        RemoveHandler x-httpd-php
        php_admin_flag engine Off
        suPHP_AddHandler x-httpd-php .php
        suPHP_Engine on
        AddHandler x-httpd-php .php
        suPHP_UserGroup <USER> <GROUP>

    The config above will only activate if both mod_php and mod_suphp is loaded. Remember to replace the <VHOST>, <USER> and <GROUP> entries with the correct virtual host, Unix user and Unix group.

EDIT: In later versions of PHP, the CLI and CGI version are 2 separate binaries. You now need to edit the /etc/suphp.conf file to reflect the correct binary in the x-httpd-php=php:/usr/bin/php-cgi entry. To determine which binary you need to add, simple do a php -v on the command line. The binary that outputs the cgi information as part of the version information, is the correct binary.