โ˜• XOPSSCHOOL โ€” LEARNING MADE AFFORDABLE
Build the Skills Your Next Career Move Demands.
For the Price of One Coffee a Month.
Why spend hundreds on individual courses? Unlock an entire year of technical learning with one Coffee Pass.
US$4.90 /month
US$58.80/year
โ‚น499 + GST/month
โ‚น5,988 + GST/year
โ‚ฌ4.90 /month
โ‚ฌ58.80/year
12 Months of Access • Billed Annually • No Automatic Renewal
DevOps • Cloud • SRE • Kubernetes • Terraform • DevSecOps • AI • AIOps • MLOps • LLMOps • FinOps • GitOps • Platform Engineering & Much More
192
Premium Courses
1,085
Video Sessions
99
Ops Disciplines
86
Tool Courses
340
Assignments
227
Quizzes
โœ“ QR-Verifiable Certificates   โœ“ Learn at Your Own Pace   โœ“ Hands-on Learning   โœ“ New Courses Included
Learn from real-world, instructor-led video sessions by
Rajesh Kumar
Principal Architect • Trainer • Mentor • 15+ Years of Industry Experience
โ˜• Get My Coffee Pass โ€” Start Learning Today →
One Payment. Every Premium Course. One Full Year.
The best investment you can make is in the person you are becoming.

Setup phpvibe and mediavide with subdirectory

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.

WhereSettingValue for /videos
File systemFolder that holds PHPVibe/var/www/html/videos
.htaccessRewriteBase/videos
Database table vibe_optionsSiteBasePath optionvideos (no slashes)
vibe_config.phpSite URLhttps://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

  1. Back up the database before editing it: mysqldump -u root -p phpvibe_db > phpvibe_backup.sql.
  2. Find the base path option by name, not by ID. Option IDs can differ between installs, so option_id = 39 from the example above may point to a different setting on your database.
  3. Set the site URL in vibe_config.php to the full subdirectory URL, including the trailing slash, for example https://example.com/videos/.
  4. Clear the contents of the cache folder mentioned above (moderator/cache on Linux, which uses forward slashes). Leave the folder itself in place, and make sure the web server user can write to it.
  5. Log in to the admin panel and check that Settings โ†’ Permalinks shows videos as 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

SymptomLikely causeFix
Home page works, every other page returns 404mod_rewrite is off, AllowOverride None, or RewriteBase is wrongEnable rewrite, allow overrides, and set RewriteBase /videos
Links or redirects point to the domain rootSiteBasePath or the site URL is still set for the rootUpdate vibe_options and vibe_config.php, then clear the cache
500 Internal Server Error right after editing .htaccessTypo, or a directive that is not allowed in .htaccessCheck 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 PHPInstall the extension, or use a PHP version your PHPVibe release supports
Admin login loops or will not openNo admin row in vibe_users, stale cache, or a site URL mismatchCheck the user table, clear the cache, and confirm the URL scheme (http vs https)
Uploads fail with 403 or 406A ModSecurity rule is blocking the requestExclude 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

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals

Related Posts

Apache: Comprehensive List of .htaccess Directives, Rules, and Commands

However, an โ€œabsolutely completeโ€ list is technically impossible to print here in fullโ€”because the .htaccess file can use nearly any Apache directive that is allowed by the…

Read More

Increasing the Maximum Image Upload Size on a WordPress Site

Increasing the upload file size limit in WordPress allows you to upload larger images (or other media) without errors. Many hosting providers set a default upload limit…

Read More

Laravel Tutorials: How to run Laravel Projects in Subdirectory

The issue you’re experiencing is common with Laravel applications when deployed in a subdirectory. By default, Laravel’s entry point is the public directory, which means you need…

Read More

How to Secure .git repo repository files and directory web inaccessible

Many times, people use git repository to host website in productions by clone-push-pull but it has one drawbacks, it appears the .git directory is accessible via the…

Read More

Apache non www to www config Setting

Rajesh Kumar 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…

Read More

How to force/redirect from http to https using .htaccess

This is the best for www and for HTTPS, for proxy and no proxy users Example Code – 1 – Forcing the domain to serve securely using…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x