This HTML5 document contains 31 embedded RDF statements represented using HTML+Microdata notation.

The embedded RDF content will be recognized by any processor of HTML5 Microdata.

PrefixNamespace IRI
dctermshttp://purl.org/dc/terms/
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n12http://vos.openlinksw.com/dataspace/services/wiki/
oplhttp://www.openlinksw.com/schema/attribution#
n2http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/
n16http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VOSBldPHP/sioc.
dchttp://purl.org/dc/elements/1.1/
n9http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n13http://rdfs.org/sioc/services#
n8http://www.php.net/downloads/
siocthttp://rdfs.org/sioc/types#
n4http://vos.openlinksw.com/dataspace/person/dav#
n11http://vos.openlinksw.com/dataspace/owiki/wiki/
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n10http://vos.openlinksw.com/dataspace/owiki#
xsdhhttp://www.w3.org/2001/XMLSchema#
n19http://vos.openlinksw.com/dataspace/person/owiki#
siochttp://rdfs.org/sioc/ns#
Subject Item
n4:this
foaf:made
n2:VOSBldPHP
Subject Item
n9:this
sioc:creator_of
n2:VOSBldPHP
Subject Item
n12:item
n13:services_of
n2:VOSBldPHP
Subject Item
n10:this
sioc:creator_of
n2:VOSBldPHP
Subject Item
n11:VOS
sioc:container_of
n2:VOSBldPHP
atom:entry
n2:VOSBldPHP
atom:contains
n2:VOSBldPHP
Subject Item
n2:VOSIndex
sioc:links_to
n2:VOSBldPHP
Subject Item
n2:VOSBldPHP
rdf:type
atom:Entry sioct:Comment
dcterms:created
2017-06-13T05:46:48.090717
dcterms:modified
2017-06-29T07:35:06.143909
rdfs:label
VOSBldPHP
foaf:maker
n4:this n19:this
dc:title
VOSBldPHP
opl:isDescribedUsing
n16:rdf
sioc:has_creator
n9:this n10:this
sioc:content
%VOSWARNING% %VOSNAV% ---++PHP SAPI module for Virtuoso This is a SAPI module for PHP 5.x, implemented as a Virtuoso loadable module. ---+++Building php To build the plugin, you first need to build a libphp5.so, configured with ZTS (Zend Thread Safety), thus download a copy of the [[http://www.php.net/downloads/][PHP sources]]. The version tested against was 5.2.10. 1 In the php source directory, execute something similar to: <verbatim> ./configure \ --prefix=/usr/local/php-5.2.10 \ --enable-maintainer-zts \ --enable-embed=shared \ --with-config-file-path=. \ --with-tsrm-pthreads \ --disable-static \ --disable-cgi \ --disable-ipv6 \ --without-mysql \ --without-pear \ --enable-bcmath=shared \ --enable-calendar \ --enable-dbase=shared \ --enable-dba=shared \ --enable-dom=shared \ --enable-exif=shared \ --enable-ftp=shared \ --enable-gd-native-ttf \ --enable-mbstring=shared \ --enable-pdo \ --enable-shmop=shared \ --enable-soap=shared \ --enable-sockets=shared \ --enable-sysvmsg=shared \ --enable-sysvsem=shared \ --enable-sysvshm=shared \ --enable-wddx=shared \ --enable-xmlreader=shared \ --enable-xmlwriter=shared \ --with-bz2=shared \ --with-curl=shared \ --with-gd=shared \ --with-iodbc=/usr/local/iODBC \ --with-ldap=shared \ --with-mime-magic=shared \ --with-openssl=shared \ --with-pdo-odbc="generic,/usr/local/iODBC,iodbc,-L/usr/local/iODBC/lib,-I/usr/local/iODBC/include" \ --with-sqlite=shared \ --with-xmlrpc=shared \ --with-xsl=shared \ --with-xsl=shared \ --with-zlib \ ... NOTE: The options above require a number of other libraries to be installed prior to building PHP. On systems where these external libraries are not available as system libraries you may need additional configure options to point where certain libraries are installed. </verbatim> 1 Next build and install the php packages. <verbatim> make make install </verbatim> 1 In the Virtuoso Open Source directory, execute the following command: <verbatim> ./configure .... --enable-php5=/usr/local/php-5.2.10 ...... or if you configured Virtuoso before in this directory: ./config.nice --enable-php5=/usr/local/php-5.2.10 so the build process knows where to find the necessary PHP header files. </verbatim> At the end of the configure step, the summary screen should indicate that the BUILD_OPTS includes "php5". If this is not the case the config.log file should contain information why configure was unable to locate your php5 installation. ---+++Installation 1 Copy the libphp5.so into same directory where virtuoso installs the hosting_php5.so plugin e.g. <verbatim> PREFIX/hosting/libphp5.so. </verbatim> 1 If you have built PHP with shared extensions, you can copy them in <verbatim> PREFIX/hosting/php </verbatim> 1 Copy the php.ini-recommended from the php distro to the same directory as your virtuoso.ini e.g. <verbatim> PREFIX/database/php.ini. </verbatim> 1 Edit your php.ini to change the extensions_dir setting to the directory where you put your extensions, e.g. <verbatim> extensions_dir = PREFIX/hosting/php </verbatim> 1 Register the plugin in your virtuoso.ini: <verbatim> [Plugins] .. Load7 = attach, libphp5.so Load8 = Hosting, hosting_php.so </verbatim> This will enable the hosting_php plugin to dynamically hook into the PHP library. ---+++ Virtuoso PHP Extensions ---++++Settings The Virtuoso php hosting plugin adds the following default settings to the php.ini file: <verbatim> [Virtuoso] virtuoso.logging = On virtuoso.local_dsn = Local Virtuoso virtuoso.allow_dba = 0 </verbatim> If <code>virtuoso.logging<code> is On, all php messages are passed back to the virtuoso logwriter. The <code>virtuoso.local_dsn</code> is by default set to "Local Virtuoso" which is the DSN in your odbc.ini file normally associated with your local virtuoso database. The <code>virtuoso.allow_dba</code> option rejects the use of the dba uid when using the <code>&#95;&#95;virt&#95;internal&#95;dsn()</code> function detailed below. ---++++Functions <b> &#95;&#95;virt&#95;internal&#95;dsn([optional dsn])</b> Normally when programming a PHP application you have to store datasource, username and password credentials for making ODBC connections back into the database. This can be a security risk and requires the administrator to fix scripts manually when he wants to run a hosted application under its own sql account. The &#95;&#95;virt&#95;internal&#95;dsn() function returns an ODBC connect string based on the VSP user that owns the Virtual Directory. It starts by verifying that the Virtual Directory has been properly setup and that there is a valid user that has not been disabled and is allowed to make SQL connections, else it will log a message and return FALSE. If the user is a system privileged user like dba or dav and the virtuoso.allow.dba setting is disabled, the function will log a message and return FALSE. The function will return an ODBC <nop>SQLDriverConnect string using either the supplied optional dsn or the virtuoso.local&#95;dsn and the uid/pwd credentials of the virtual directory in the form: <verbatim> DSN=use_dsn;UID=uid;PWD=pwd </verbatim> This string can be used directly with the odbc_connect function in your script. If you want your PHP application also outside of the virtuoso hosting environment, you can use it like this: <verbatim> <?php // // ODBC Connection Variables // $o_DSN = 'ChangeMe'; $o_UID = 'ChangeMe'; $o_PWD = 'ChangeMe'; if (function_exists ('__virt_internal_dsn')) { $db = odbc_connect (__virt_internal_dsn(), null, null); } else { $db = odbc_connect ($o_DSN, $o_UID, $o_PWD); } if (!$db) error_log ('odbc_connect failed'); // ..... odbc_disconnect ($db); ?> </verbatim> Here is an example of a Virtuoso SQL script that creates a database schema and a table, a user that owns the schema and a vhost entry that can be used for a PHP application. <verbatim> myapp.sql: -- -- Sample script -- -- -- Create the MYAPP schema -- use MYAPP ; -- -- Create a user MYADMIN who owns the table in this schema -- db.dba.user_create ( 'MYADMIN', -- Account name uuid (), -- Random UUID as password vector ('LOGIN_QUALIFIER', 'MYAPP', 'SQL_ENABLE', 1, 'DAV_ENABLE', 0, 'FULL_NAME', 'MYAPP Administrator')) ; -- -- Create the tables in this schema -- create table MYTABLE ( mt_id INTEGER NOT NULL PRIMARY KEY, mt_value VARCHAR (32) ) ; -- -- Insert some sample data -- insert into MYAPP.DBA.MYTABLE VALUES (1, 'Apple'); insert into MYAPP.DBA.MYTABLE VALUES (2, 'Pear'); insert into MYAPP.DBA.MYTABLE VALUES (3, 'Banana'); insert into MYAPP.DBA.MYTABLE VALUES (4, 'Pineapple'); -- -- Add permissions -- grant all privileges on MYAPP.DBA.MYTABLE to MYADMIN ; -- -- Create a new virtual path in Virtuoso -- -- Point to $VIRTUOSO/vsp/testapp on filesystem -- db.dba.vhost_remove (lpath=>'/myapp'); db.dba.vhost_define ( lpath=>'/myapp', ppath=>'/testapp', is_dav=>0, is_brws=>0, vsp_user=>'MYADMIN', def_page=>'myapp.php') ; -- -- End of sample -- </verbatim> And the $VIRTUOSO/vsp/testapp/myapp.php: <verbatim> <?php $db = odbc_connect (__virt_internal_dsn(), null, null); if (!$db) error_log ('odbc_connect failed'); $rs = odbc_exec ($db, 'select * from MYAPP.DBA.MYTEST'); odbc_result_all ($rs); odbc_close ($db); ?> </verbatim> %VOSCOPY%
sioc:id
ce3943ba6c2830951f035dd67486e1ed
sioc:link
n2:VOSBldPHP
sioc:has_container
n11:VOS
n13:has_services
n12:item
atom:title
VOSBldPHP
sioc:links_to
n8:
atom:source
n11:VOS
atom:author
n4:this
atom:published
2017-06-13T05:46:48Z
atom:updated
2017-06-29T07:35:06Z
sioc:topic
n11:VOS