php errors on new DirectAdmin install

kbarg

Verified User
Joined
Dec 19, 2020
Messages
26
My php includes and requires no longer work. I am running php 7.4 and the old cpanel server was as well.

Anyone have similar issues?

Debian 10 64bit


DirectAdminRunning1.61.5
DovecotRunning2.3.11.3 (502c39af9)
EximRunning4.94
ApacheRunning2.4.46
MySQLRunning10.4.17
NamedRunning9.11.5
phpInstalled7.4.13
Pure-FTPdRunning1.0.49
sshdRunning
 
What is 'doesn't work'?
Can you be a little clearer about what is happening?
Tell more about the errors and your include/require implementation.
 
As I said, my PHP Includes and Requires NO longer work I thought that was pretty straight forward.
 
Debian 10 x64
Apache 2.4.46
PHP 7.4.13

I do have a require_once that does work.

My page calls for the ID

PHP:
<?
    $id = $_GET['id'];
    if ( $id == "home" ) $id = "home";
    if ( !$id || ($id == "") ) $id = "home";
?>

and uses that in conjunction with my whitelist and stuff to display my included pages so pages that are not in the whitelist are not useable.

PHP:
<?
$whitelist = array('home', 'page1', 'page2', 'page3', 'terms', 'privacy');

if (in_array($_GET['id'], $whitelist)) {
include("/home/USERNAME/public_html/pages/" . $id . ".inc");
} else {
include('/home/USERNAME/public_html/pages/home.inc');
}
?>

I also have stuff put in my .htaccess to remove "index.php?id=" from my URLS and make it so my php pages load like https://domain.com/page1 etc.

Code:
#remove .php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

#for pretty url
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ index.php?id=$1 [NC,L]

This set up worked perfectly on my CentOS 7.9 w/ cPanel install before I reinstalled with Debian 10 w/ DirectAdmin.

When googling the problem people MIGHTVE had a similar issue with the symlinked private_html redirecting to the public_html etc.
 
You seem to be using short open tag, try a full one, or enable short_open_tag in php.ini.
 
LOL, why was that even an issue.

short_open_tag was ON already is what it said, but once I changed them from <? to <?php everything works. Sorry for the trouble and thank you for your help!
 
Some of us are not Coders here... We are Server admins. To a programmer it might be straight forward.
As I said, my PHP Includes and Requires NO longer work I thought that was pretty straight forward.
Glad smtalk helped shed light on issue... glad it's working.
 
The real problem was that the PHP-script wasn't working because the use of the short-tags. <?

You might have placed a few echoes in your script yourself, only to find that it is your PHP script, and not the include and required(_once).
;)
 
Back
Top