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, the SiteBasePath option in the database, the site URL in vibe_config.php, 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.
Checklist 1 – Content of .htacces
$ more .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /video
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
</IfModule>
<ifModule mod_headers.c>
Header set Access-Control-Allow-Origin: *
</ifModule>Code language: HTML, XML (xml)
Checklist 2 – Make sure admin user is created in database table vibe_users
Checklist 3 – Mcrypt must be installed
Checklist 4 – php -version
$ php -version
PHP 7.1.33 (cli) (built: Dec 17 2019 23:26:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33, Copyright (c) 1Code language: JavaScript (javascript)
Checklist 5 – sql_mode is disable
To check whether strict mode is enabled or not run the below sql:
SHOW VARIABLES LIKE ‘sql_mode’;
Reference – https://stackoverflow.com/questions/40881773/how-to-turn-on-off-mysql-strict-mode-in-localhost-xampp
Checklist 6 – Remove a cache moderator\cache
Checklist 7 – Disable mod_security by adding following code in .htaccess
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
Code language: HTML, XML (xml)
Checklist 8 – edit vibe_options table with vibe_options
UPDATE `vibe_options` SET `option_value` = 'videos' WHERE `vibe_options`.`option_id` = 39;Code language: JavaScript (javascript)
Some Suggestions
- Open the admin, go to Settings -> Permalinks section and set tv in the base path field.
- Open the main .htaccess file and change RewriteRule from / to /tv
- Open vibe_config.php and change the site_url field to the new link of the site.
Last Solutions for sub directory
If you can't open the admin panel, open index.php and find
if(!nullval(get_option('SiteBasePath',null))) {
$router->setBasePath('/'.get_option('SiteBasePath'));
}
Replace it with
$router->setBasePath('/videos');Code language: PHP (php)
How the subdirectory settings fit together
The checklist above uses three different folder names: /video in .htaccess, videos in the SQL and index.php, and tv in the suggestions. They are examples taken from different installs. On a real site every setting must use the same 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 videos throughout.
| Where | Setting | Value for /videos |
|---|---|---|
| File system | Folder that holds PHPVibe | /var/www/html/videos |
.htaccess | RewriteBase | /videos |
Database table vibe_options | SiteBasePath option | videos (no slashes) |
vibe_config.php | Site URL | https://example.com/videos/ |
index.php (fallback only) | $router->setBasePath() | '/videos' (leading slash, no trailing slash) |
Prepare Apache and use a consistent .htaccess
A .htaccess file only works if mod_rewrite 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:
sudo a2enmod rewrite headers
sudo systemctl reload apache2
# Confirm the modules are loaded
apachectl -M | grep -E 'rewrite|headers'Code language: PHP (php)
Then allow overrides for the document root in the virtual host and reload Apache again:
<Directory /var/www/html>
AllowOverride All
Require all granted
</Directory>Code language: HTML, XML (xml)
Put this .htaccess inside the videos folder. It is the file from the example above with RewriteBase matched to the folder name and the header value quoted:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /videos
# Let index.php itself pass through untouched
RewriteRule ^index\.php$ - [L]
# Send anything that is not a real file or directory to the front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
</IfModule>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>Code language: PHP (php)
Note: Access-Control-Allow-Origin "*" 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.
Nginx equivalent
Nginx ignores .htaccess. 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:
location /videos/ {
try_files $uri $uri/ /videos/index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}Code language: PHP (php)
sudo nginx -t && sudo systemctl reload nginx
Point PHPVibe at the subdirectory
- Back up the database before editing it:
mysqldump -u root -p phpvibe_db > phpvibe_backup.sql. - Find the base path option by name, not by ID. Option IDs can differ between installs, so
option_id = 39from the example above may point to a different setting on your database. - Set the site URL in
vibe_config.phpto the full subdirectory URL, including the trailing slash, for examplehttps://example.com/videos/. - Clear the contents of the cache folder mentioned above (
moderator/cacheon Linux, which uses forward slashes). Leave the folder itself in place, and make sure the web server user can write to it. - Log in to the admin panel and check that Settings โ Permalinks shows
videosas the base path.
-- Inspect first
SELECT option_id, option_name, option_value
FROM vibe_options
WHERE option_name LIKE '%BasePath%';
-- Then update by name
UPDATE vibe_options
SET option_value = 'videos'
WHERE option_name = 'SiteBasePath';Code language: JavaScript (javascript)
# Clear cached files but keep the directory
find /var/www/html/videos/moderator/cache -mindepth 1 -delete
sudo chown -R www-data:www-data /var/www/html/videos/moderator/cacheCode language: PHP (php)
Note: Hard-coding $router->setBasePath('/videos'); in index.php, as the last solution above does, makes PHPVibe ignore the SiteBasePath option. It is also lost when you upgrade PHPVibe and index.php is replaced. Use it only to get back into the admin panel. Once you are in, fix SiteBasePath and restore the original code.
PHP version and mcrypt
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 mcrypt_* functions need either an old PHP version or the PECL extension.
# Show the version and check for the extension
php -v
php -m | grep -i mcrypt
# PHP 7.2 and later: build mcrypt from PECL (Debian/Ubuntu)
sudo apt install php-dev libmcrypt-dev php-pear
sudo pecl install mcrypt
# Add extension=mcrypt.so to the php.ini used by your web server, then restart it
sudo systemctl restart apache2 # or php-fpmCode language: PHP (php)
Note: The command-line PHP and the web server's PHP can be different builds with different php.ini files. Check the version and extensions the web server actually uses with a temporary phpinfo() page, and delete that page afterwards.
Relax MySQL strict mode
Older PHPVibe code inserts empty strings into integer and date columns. Under strict mode this fails with errors such as Incorrect integer value or Field doesn't have a default value. MySQL 5.7 and later enable STRICT_TRANS_TABLES and ONLY_FULL_GROUP_BY by default. Check the current mode and change it as follows:
SELECT @@GLOBAL.sql_mode;
-- Takes effect for new connections, but is lost on restart
SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';
-- MySQL 8.0 only: also survives restarts
SET PERSIST sql_mode = 'NO_ENGINE_SUBSTITUTION';Code language: PHP (php)
To make the change permanent on MariaDB or older MySQL versions, add it to the server configuration (for example /etc/mysql/my.cnf or a file in /etc/mysql/conf.d/) and restart the database:
[mysqld]
sql_mode = "NO_ENGINE_SUBSTITUTION"Code language: JavaScript (javascript)
ModSecurity: use rule exclusions, not SecFilterEngine
SecFilterEngine and SecFilterScanPOST are ModSecurity 1.x directives. Current servers run ModSecurity 2.x or later. Their module identifier is not mod_security.c, so the <IfModule> block in the example above is skipped and does nothing. ModSecurity 2.x also does not read its directives from .htaccess 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:
<IfModule security2_module>
<LocationMatch "^/videos/moderator/">
# Replace with the rule ID from the audit log
SecRuleRemoveById 949110
</LocationMatch>
</IfModule>Code language: HTML, XML (xml)
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.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Home page works, every other page returns 404 | mod_rewrite is off, AllowOverride None, or RewriteBase is wrong | Enable rewrite, allow overrides, and set RewriteBase /videos |
| Links or redirects point to the domain root | SiteBasePath or the site URL is still set for the root | Update vibe_options and vibe_config.php, then clear the cache |
500 Internal Server Error right after editing .htaccess | Typo, or a directive that is not allowed in .htaccess | Check the Apache error log (/var/log/apache2/error.log) |
Blank page or Call to undefined function mcrypt_encrypt() | mcrypt is missing from the web server's PHP | Install the extension, or use a PHP version your PHPVibe release supports |
| Admin login loops or will not open | No admin row in vibe_users, stale cache, or a site URL mismatch | Check the user table, clear the cache, and confirm the URL scheme (http vs https) |
| Uploads fail with 403 or 406 | A ModSecurity rule is blocking the request | Exclude the specific rule ID |
Frequently asked questions
Why does only the PHPVibe home page work in a subdirectory?
The rewrite rules are not being applied. Usually mod_rewrite is disabled, the directory has AllowOverride None, or RewriteBase does not match the folder name.
Should SiteBasePath include slashes?
No. Store only the folder name, such as videos. The code adds the leading slash itself when it calls $router->setBasePath('/'.get_option('SiteBasePath')).
Can PHPVibe run on PHP 8?
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's requirements for your version before you upgrade PHP.
Is it safe to disable MySQL strict mode?
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 NO_ENGINE_SUBSTITUTION set.
How do I disable mod_security from .htaccess?
On ModSecurity 2.x and later you generally cannot, because it does not read .htaccess. Remove specific rules by ID in the server configuration, or ask your hosting provider to do it.
Related tutorials
- More PHP tutorials
- What are the Authentication type in phpmyadmin which for config.inc.php
- Top 50 PHP Interview Questions and Answers
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals