Skip to content

Instantly share code, notes, and snippets.

@witwall
Last active November 19, 2015 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save witwall/fda20dcfd6a65abce8ab to your computer and use it in GitHub Desktop.
Save witwall/fda20dcfd6a65abce8ab to your computer and use it in GitHub Desktop.
;for windows
extension_dir = "ext"
extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
;for linux
extension=php_pdo_sqlite.so
extension=php_sqlite3.so
<?PHP
//bases on http://silex.sensiolabs.org/doc/web_servers.html#php-5-4
$filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
return false;
}else {
$path=preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if(substr($path,strlen($path) - 1, 1) !== '/' ){
if(substr($path,strlen($path) - 4, 4) !== '.php'){
header( 'Location: '.$path . '/index.php' );
}
else
return false;
}else{
include_once $_SERVER['DOCUMENT_ROOT'].$_SERVER['SCRIPT_NAME'];
}
}
?>
<?php
//fork https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/sqlite-wp-config.php
/*
wp-config file for SQLite Integration
Convert MySQL - mysql2sqlite.sh: https://gist.github.com/esperlu/943776
Administer: https://bitbucket.org/phpliteadmin/public
Installation
wget -q -O- https://wordpress.org/latest.tar.gz | tar -xz
cd wordpress/wp-content/plugins/
wget https://downloads.wordpress.org/plugin/sqlite-integration.zip
unzip sqlite-integration.zip
cp sqlite-integration/db.php ../
*/
define( 'USE_MYSQL', false );
define( 'DB_NAME', 'sqlite' );
define( 'DB_CHARSET', 'utf8' );
//define( 'USE_MYSQL', true );
//define( 'DB_FILE', '.ht.sqlite' );
//define( 'DB_DIR', '/ABS/PATH/wp-content/database/' );
// Dummy data for plugins
define( 'DB_USER', 'sqlite' );
define( 'DB_PASSWORD', 'sqlite' );
define( 'DB_HOST', 'sqlite' );
define( 'DB_COLLATE', '' );
$table_prefix = 'sql3_';
/*
Salts
Alt + U (mcedit/Paste output of...)
wget -qO- https://api.wordpress.org/secret-key/1.1/salt/
*/
/*
Webserver
apt-get install -y php5-cli
php -S
*/
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
/**#@+
* Authentication Unique Keys and Salts.
* get it from here,https://api.wordpress.org/secret-key/1.1/salt
* ....
*/
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
/**
* WordPress Database Table prefix.
* ...
*/
$table_prefix = 'wp_';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment