{"id":27005,"date":"2026-12-06T22:06:07","date_gmt":"2026-12-06T22:06:07","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=27005"},"modified":"2026-12-06T22:06:07","modified_gmt":"2026-12-06T22:06:07","slug":"setup-phpvibe-and-mediavide-with-subdirectory","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/setup-phpvibe-and-mediavide-with-subdirectory\/","title":{"rendered":"Setup phpvibe and mediavide with subdirectory"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To run PHPVibe in a subdirectory such as https:\/\/example.com\/videos\/ instead of the domain root, five settings have to agree: the folder name on disk, the <code>.htaccess<\/code> RewriteBase, the <code>SiteBasePath<\/code> option in the database, the site URL in <code>vibe_config.php<\/code>, and the router base path. The checklist below lists the fixes that usually matter. The sections after it explain each one, correct a few outdated or inconsistent items, and add server configuration and troubleshooting steps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-1-content-of-htacces\">Checklist 1 &#8211; Content of .htacces<\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\">$ more .htaccess\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">IfModule<\/span> <span class=\"hljs-attr\">mod_rewrite.c<\/span>&gt;<\/span>\r\nRewriteEngine on\r\nRewriteBase \/video\r\nRewriteRule ^index\\.php$ - &#91;L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^(.*)\/?$ index.php &#91;L]\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">IfModule<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ifModule<\/span> <span class=\"hljs-attr\">mod_headers.c<\/span>&gt;<\/span>\r\n    Header set Access-Control-Allow-Origin: *\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">ifModule<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-2-make-sure-admin-user-is-created-in-database-table-vibe-users\">Checklist 2 &#8211; Make sure admin user is created in database table vibe_users<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-3-mcrypt-must-be-installed\">Checklist 3 &#8211; Mcrypt must be installed<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-4-php-version\">Checklist 4 &#8211; php -version<\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">$ php -version\r\nPHP <span class=\"hljs-number\">7.1<\/span><span class=\"hljs-number\">.33<\/span> (cli) (built: Dec <span class=\"hljs-number\">17<\/span> <span class=\"hljs-number\">2019<\/span> <span class=\"hljs-number\">23<\/span>:<span class=\"hljs-number\">26<\/span>:<span class=\"hljs-number\">37<\/span>) ( NTS )\r\nCopyright (c) <span class=\"hljs-number\">1997<\/span><span class=\"hljs-number\">-2018<\/span> The PHP Group\r\nZend Engine v3<span class=\"hljs-number\">.1<\/span><span class=\"hljs-number\">.0<\/span>, Copyright (c) <span class=\"hljs-number\">1998<\/span><span class=\"hljs-number\">-2018<\/span> Zend Technologies\r\n    <span class=\"hljs-keyword\">with<\/span> Zend OPcache v7<span class=\"hljs-number\">.1<\/span><span class=\"hljs-number\">.33<\/span>, Copyright (c) <span class=\"hljs-number\">1<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-5-sql-mode-is-disable\">Checklist 5 &#8211; sql_mode is disable<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To check whether strict mode is enabled or not run the below sql:<br>SHOW VARIABLES LIKE &#8216;sql_mode&#8217;;<br>Reference &#8211; https:\/\/stackoverflow.com\/questions\/40881773\/how-to-turn-on-off-mysql-strict-mode-in-localhost-xampp<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-6-remove-a-cache-moderator-cache\">Checklist 6 &#8211; Remove a cache moderator\\cache<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-7-disable-mod-security-by-adding-following-code-in-htaccess\">Checklist 7 &#8211; Disable mod_security by adding following code in .htaccess<\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">IfModule<\/span> <span class=\"hljs-attr\">mod_security.c<\/span>&gt;<\/span>\n  \r\n  SecFilterEngine Off\n  \r\n  SecFilterScanPOST Off\n\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">IfModule<\/span>&gt;<\/span>\r\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist-8-edit-vibe-options-table-with-vibe-options\">Checklist 8 &#8211; edit vibe_options table with vibe_options<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">UPDATE <span class=\"hljs-string\">`vibe_options`<\/span> SET <span class=\"hljs-string\">`option_value`<\/span> = <span class=\"hljs-string\">'videos'<\/span> WHERE <span class=\"hljs-string\">`vibe_options`<\/span>.<span class=\"hljs-string\">`option_id`<\/span> = <span class=\"hljs-number\">39<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"some-suggestions\">Some Suggestions<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Open the admin, go to Settings -&gt; Permalinks section and set tv in the base path field.<\/li><li>Open the main .htaccess file and change RewriteRule from \/ to \/tv<\/li><li>Open vibe_config.php and change the site_url field to the new link of the site.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"last-solutions-for-sub-directory\">Last Solutions for sub directory<\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">If<\/span> you can<span class=\"hljs-string\">'t open the admin panel, open index.php and find\r\n\r\nif(!nullval(get_option('<\/span>SiteBasePath<span class=\"hljs-string\">',null))) {\r\n$router-&gt;setBasePath('<\/span>\/<span class=\"hljs-string\">'.get_option('<\/span>SiteBasePath<span class=\"hljs-string\">'));\r\n} \r\n\r\nReplace it with\r\n\r\n$router-&gt;setBasePath('<\/span>\/videos<span class=\"hljs-string\">');<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How the subdirectory settings fit together<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The checklist above uses three different folder names: <code>\/video<\/code> in <code>.htaccess<\/code>, <code>videos<\/code> in the SQL and <code>index.php<\/code>, and <code>tv<\/code> in the suggestions. They are examples taken from different installs. On a real site every setting must use the <strong>same<\/strong> name. Otherwise you get 404 errors, redirects back to the domain root, or an admin panel that will not load. The rest of this page uses <code>videos<\/code> throughout.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Where<\/th><th>Setting<\/th><th>Value for \/videos<\/th><\/tr><\/thead><tbody><tr><td>File system<\/td><td>Folder that holds PHPVibe<\/td><td><code>\/var\/www\/html\/videos<\/code><\/td><\/tr><tr><td><code>.htaccess<\/code><\/td><td><code>RewriteBase<\/code><\/td><td><code>\/videos<\/code><\/td><\/tr><tr><td>Database table <code>vibe_options<\/code><\/td><td><code>SiteBasePath<\/code> option<\/td><td><code>videos<\/code> (no slashes)<\/td><\/tr><tr><td><code>vibe_config.php<\/code><\/td><td>Site URL<\/td><td><code>https:\/\/example.com\/videos\/<\/code><\/td><\/tr><tr><td><code>index.php<\/code> (fallback only)<\/td><td><code>$router-&gt;setBasePath()<\/code><\/td><td><code>&#039;\/videos&#039;<\/code> (leading slash, no trailing slash)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Prepare Apache and use a consistent .htaccess<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A <code>.htaccess<\/code> file only works if <code>mod_rewrite<\/code> is loaded and the directory allows overrides. If either is missing, the home page loads but every other URL returns 404. On Debian or Ubuntu, enable the modules and reload Apache:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">sudo a2enmod rewrite headers\nsudo systemctl reload apache2\n\n<span class=\"hljs-comment\"># Confirm the modules are loaded<\/span>\napachectl -M | grep -E <span class=\"hljs-string\">'rewrite|headers'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Then allow overrides for the document root in the virtual host and reload Apache again:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Directory<\/span> \/<span class=\"hljs-attr\">var<\/span>\/<span class=\"hljs-attr\">www<\/span>\/<span class=\"hljs-attr\">html<\/span>&gt;<\/span>\n    AllowOverride All\n    Require all granted\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">Directory<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Put this <code>.htaccess<\/code> inside the <code>videos<\/code> folder. It is the file from the example above with <code>RewriteBase<\/code> matched to the folder name and the header value quoted:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">&lt;IfModule mod_rewrite.c&gt;\n    RewriteEngine On\n    RewriteBase \/videos\n    <span class=\"hljs-comment\"># Let index.php itself pass through untouched<\/span>\n    RewriteRule ^index\\.php$ - &#91;L]\n    <span class=\"hljs-comment\"># Send anything that is not a real file or directory to the front controller<\/span>\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME} !-d\n    RewriteRule ^(.*)\/?$ index.php &#91;L]\n&lt;\/IfModule&gt;\n\n&lt;IfModule mod_headers.c&gt;\n    Header set Access-Control-Allow-Origin <span class=\"hljs-string\">\"*\"<\/span>\n&lt;\/IfModule&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> <code>Access-Control-Allow-Origin &quot;*&quot;<\/code> allows any website to read responses from your site in the browser. Keep it only if embeds or players on other domains actually need it. Otherwise remove it or set it to the specific origin that needs access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Nginx equivalent<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nginx ignores <code>.htaccess<\/code>. If PHPVibe runs behind Nginx with PHP-FPM, put the front-controller rule in the server block instead. Adjust the PHP-FPM socket path to match your PHP version:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">location \/videos\/ {\n    try_files $uri $uri\/ \/videos\/index.php$is_args$args;\n}\n\nlocation ~ \\.php$ {\n    <span class=\"hljs-keyword\">include<\/span> snippets\/fastcgi-php.conf;\n    fastcgi_pass unix:\/run\/php\/php-fpm.sock;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">sudo nginx -t &amp;&amp; sudo systemctl reload nginx<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Point PHPVibe at the subdirectory<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Back up the database<\/strong> before editing it: <code>mysqldump -u root -p phpvibe_db &gt; phpvibe_backup.sql<\/code>.<\/li>\n\n\n<li>Find the base path option by name, not by ID. Option IDs can differ between installs, so <code>option_id = 39<\/code> from the example above may point to a different setting on your database.<\/li>\n\n\n<li>Set the site URL in <code>vibe_config.php<\/code> to the full subdirectory URL, including the trailing slash, for example <code>https:\/\/example.com\/videos\/<\/code>.<\/li>\n\n\n<li>Clear the <strong>contents<\/strong> of the cache folder mentioned above (<code>moderator\/cache<\/code> on Linux, which uses forward slashes). Leave the folder itself in place, and make sure the web server user can write to it.<\/li>\n\n\n<li>Log in to the admin panel and check that Settings \u2192 Permalinks shows <code>videos<\/code> as the base path.<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">-- Inspect first\nSELECT option_id, option_name, option_value\nFROM vibe_options\nWHERE option_name LIKE <span class=\"hljs-string\">'%BasePath%'<\/span>;\n\n-- Then update by name\nUPDATE vibe_options\nSET option_value = <span class=\"hljs-string\">'videos'<\/span>\nWHERE option_name = <span class=\"hljs-string\">'SiteBasePath'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># Clear cached files but keep the directory<\/span>\nfind \/<span class=\"hljs-keyword\">var<\/span>\/www\/html\/videos\/moderator\/cache -mindepth <span class=\"hljs-number\">1<\/span> -delete\nsudo chown -R www-data:www-data \/<span class=\"hljs-keyword\">var<\/span>\/www\/html\/videos\/moderator\/cache<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Hard-coding <code>$router-&gt;setBasePath(&#039;\/videos&#039;);<\/code> in <code>index.php<\/code>, as the last solution above does, makes PHPVibe ignore the <code>SiteBasePath<\/code> option. It is also lost when you upgrade PHPVibe and <code>index.php<\/code> is replaced. Use it only to get back into the admin panel. Once you are in, fix <code>SiteBasePath<\/code> and restore the original code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PHP version and mcrypt<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The example above shows PHP 7.1, and the checklist requires mcrypt. Mcrypt was deprecated in PHP 7.1 and removed from the PHP core in 7.2. It is now available only as a PECL extension. PHP 7.1 itself has been end-of-life since December 2019. Check the PHPVibe release you have for its supported PHP versions. Releases that call <code>mcrypt_*<\/code> functions need either an old PHP version or the PECL extension.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># Show the version and check for the extension<\/span>\nphp -v\nphp -m | grep -i mcrypt\n\n<span class=\"hljs-comment\"># PHP 7.2 and later: build mcrypt from PECL (Debian\/Ubuntu)<\/span>\nsudo apt install php-dev libmcrypt-dev php-pear\nsudo pecl install mcrypt\n<span class=\"hljs-comment\"># Add extension=mcrypt.so to the php.ini used by your web server, then restart it<\/span>\nsudo systemctl restart apache2   <span class=\"hljs-comment\"># or php-fpm<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The command-line PHP and the web server&#039;s PHP can be different builds with different <code>php.ini<\/code> files. Check the version and extensions the web server actually uses with a temporary <code>phpinfo()<\/code> page, and delete that page afterwards.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Relax MySQL strict mode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Older PHPVibe code inserts empty strings into integer and date columns. Under strict mode this fails with errors such as <code>Incorrect integer value<\/code> or <code>Field doesn&#039;t have a default value<\/code>. MySQL 5.7 and later enable <code>STRICT_TRANS_TABLES<\/code> and <code>ONLY_FULL_GROUP_BY<\/code> by default. Check the current mode and change it as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">SELECT @@<span class=\"hljs-keyword\">GLOBAL<\/span>.sql_mode;\n\n-- Takes effect <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">new<\/span> connections, but is lost on restart\nSET <span class=\"hljs-keyword\">GLOBAL<\/span> sql_mode = <span class=\"hljs-string\">'NO_ENGINE_SUBSTITUTION'<\/span>;\n\n-- MySQL <span class=\"hljs-number\">8.0<\/span> only: also survives restarts\nSET PERSIST sql_mode = <span class=\"hljs-string\">'NO_ENGINE_SUBSTITUTION'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">To make the change permanent on MariaDB or older MySQL versions, add it to the server configuration (for example <code>\/etc\/mysql\/my.cnf<\/code> or a file in <code>\/etc\/mysql\/conf.d\/<\/code>) and restart the database:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">&#91;mysqld]\nsql_mode = <span class=\"hljs-string\">\"NO_ENGINE_SUBSTITUTION\"<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">ModSecurity: use rule exclusions, not SecFilterEngine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>SecFilterEngine<\/code> and <code>SecFilterScanPOST<\/code> are ModSecurity 1.x directives. Current servers run ModSecurity 2.x or later. Their module identifier is not <code>mod_security.c<\/code>, so the <code>&lt;IfModule&gt;<\/code> block in the example above is skipped and does nothing. ModSecurity 2.x also does not read its directives from <code>.htaccess<\/code> unless it was specially compiled to. If uploads or admin saves return 403 or 406, find the rule ID in the ModSecurity audit log and exclude only that rule in the virtual host:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">IfModule<\/span> <span class=\"hljs-attr\">security2_module<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">LocationMatch<\/span> \"^\/<span class=\"hljs-attr\">videos<\/span>\/<span class=\"hljs-attr\">moderator<\/span>\/\"&gt;<\/span>\n        # Replace with the rule ID from the audit log\n        SecRuleRemoveById 949110\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">LocationMatch<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">IfModule<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">On shared hosting you usually cannot change ModSecurity yourself. Send the blocked URL and the rule ID to your provider and ask them to whitelist it. Do not turn the engine off for the whole site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and fixes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Symptom<\/th><th>Likely cause<\/th><th>Fix<\/th><\/tr><\/thead><tbody><tr><td>Home page works, every other page returns 404<\/td><td><code>mod_rewrite<\/code> is off, <code>AllowOverride None<\/code>, or <code>RewriteBase<\/code> is wrong<\/td><td>Enable rewrite, allow overrides, and set <code>RewriteBase \/videos<\/code><\/td><\/tr><tr><td>Links or redirects point to the domain root<\/td><td><code>SiteBasePath<\/code> or the site URL is still set for the root<\/td><td>Update <code>vibe_options<\/code> and <code>vibe_config.php<\/code>, then clear the cache<\/td><\/tr><tr><td>500 Internal Server Error right after editing <code>.htaccess<\/code><\/td><td>Typo, or a directive that is not allowed in <code>.htaccess<\/code><\/td><td>Check the Apache error log (<code>\/var\/log\/apache2\/error.log<\/code>)<\/td><\/tr><tr><td>Blank page or <code>Call to undefined function mcrypt_encrypt()<\/code><\/td><td>mcrypt is missing from the web server&#039;s PHP<\/td><td>Install the extension, or use a PHP version your PHPVibe release supports<\/td><\/tr><tr><td>Admin login loops or will not open<\/td><td>No admin row in <code>vibe_users<\/code>, stale cache, or a site URL mismatch<\/td><td>Check the user table, clear the cache, and confirm the URL scheme (http vs https)<\/td><\/tr><tr><td>Uploads fail with 403 or 406<\/td><td>A ModSecurity rule is blocking the request<\/td><td>Exclude the specific rule ID<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Why does only the PHPVibe home page work in a subdirectory?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The rewrite rules are not being applied. Usually <code>mod_rewrite<\/code> is disabled, the directory has <code>AllowOverride None<\/code>, or <code>RewriteBase<\/code> does not match the folder name.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should SiteBasePath include slashes?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Store only the folder name, such as <code>videos<\/code>. The code adds the leading slash itself when it calls <code>$router-&gt;setBasePath(&#039;\/&#039;.get_option(&#039;SiteBasePath&#039;))<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can PHPVibe run on PHP 8?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">That depends on the PHPVibe release. Older releases that rely on mcrypt or removed PHP functions will not run on PHP 8 without changes, so check the vendor&#039;s requirements for your version before you upgrade PHP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is it safe to disable MySQL strict mode?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It lets invalid values be stored silently, for example as zeros or truncated text, so you lose some data validation. Change only the server or database that PHPVibe uses, and keep <code>NO_ENGINE_SUBSTITUTION<\/code> set.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I disable mod_security from .htaccess?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On ModSecurity 2.x and later you generally cannot, because it does not read <code>.htaccess<\/code>. Remove specific rules by ID in the server configuration, or ask your hosting provider to do it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related tutorials<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/category\/programming\/php\/\">More PHP tutorials<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/what-are-the-authentication-type-in-phpmyadmin-which-for-config-inc-php\/\">What are the Authentication type in phpmyadmin which for config.inc.php<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/top-50-php-interview-questions-and-answers\/\">Top 50 PHP Interview Questions and Answers<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To run PHPVibe in a subdirectory such as https:\/\/example.com\/videos\/ instead of the domain root, five settings have to agree: the folder name on disk, the .htaccess RewriteBase,&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5150],"tags":[4506],"class_list":["post-27005","post","type-post","status-publish","format-standard","hentry","category-php","tag-htaccess"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/27005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=27005"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/27005\/revisions"}],"predecessor-version":[{"id":80713,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/27005\/revisions\/80713"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=27005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=27005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=27005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}