PHP not recognizing .inc files

Hello, I am having problems getting PHP to recognize a .inc file, I installed all of the default stuff, and when I pull up my index.php page the .inc file doesn’t get parsed.

Is there anything extra I should have to do to get a .inc file working, like edit the php5.conf file?

Normally users don’t request the .inc files directly. In fact usually they are not allowed to fetch them directly because they might contain things like MySQL account names and passwords. They are included by the .php files using directives such as:

require_once “library/util.inc”;

If those requires don’t work, have a look in /var/log/apache2/error_log to see what the problem is.

I’m not trying to get users to be able to recognize the .inc, I want the php pages to.

All I am saying in my code is:


<? include 'imports.inc'; ?>

The apache error log doesn’t have anything related to the problem, I’ll check the php error log when I get home.

Edit:

lol now that I actually posted the code I’m realizing my mistake, the <? no longer seems to work in php, not sure what version they got rid of it in. Had this problem on other pages as well, but I forgot about it.

What does it require in its place? “<?php” ?

Yes, and you have realised by now that nothing would have worked inside <? ?> and had nothing to do with the .inc.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

<? ?> (short-open-tags parameter in php.ini) has not been the default for
a while, and I believe may even be deprecated, though don’t quote me on
that without checking php.net’s docs. Anyway, use the full tags.

Good luck.

ken yap wrote:
> adaykin;2014821 Wrote:
>> lol now that I actually posted the code I’m realizing my mistake, the
>> <? no longer seems to work in php, not sure what version they got rid of
>> it in. Had this problem on other pages as well, but I forgot about it.
>
> Yes, and you have realised by now that nothing would have worked inside
> <? ?> and had nothing to do with the .inc.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJKZIY2AAoJEF+XTK08PnB5O9AP/A4UHRoFGsbt74BLyP+Jh7Fg
88uxuYy8o7jod38UuBq+w09zvKZu+FexYhWOugkmoeN18L0r3kw1rDVyXKZ0+CtB
Z/8Lx5x5oQ/W4rSgA3cexaRXzT2vnb+YfeWe+zSVQ09fcsc0rFcX/OByuoN9b4kp
Y/jRcQAdWlQHeYsazGj/h0v3SPTaVvSZ+6p/5K4k1S9mzBpc+MsG4ecF1khe9Htp
tlgW2XMQ92TtMP+X9G6IdGYPkegNKPZ95SxavRClX+ZQw9rIr4FYnuurQYSw7PbC
kXSwyAFWkzHX6ITWy/W6Ap9rY5kYR4ugildfHsOxsPNSWcQduEq7+ZmJJG4z9P/e
tVilly5mS/Fh8PtgguSx7px3PZSa4M88L3aNm8LBV6sBD/aEPZoN/4e/LyXZno8a
ULMUAQhBYrLXO8leOyuDb6qIFI6hIgBx9RzPiIBye5Qp0LQsoJJW2mVW4YOv1wj5
yTYYiK5guXC7aAneg81QOnVaWz8VIvbc2gVVMqRm5Vwrv44NiHSKRCCmbIMZ/3dv
Wb07jRnbhkuiC/EWv9FwyGkyrE0Tu6t9gflkrfx2/1NWv2gAMvtZys+rei/mE3RW
pf1/pThw7bm8pgCwF0GYbdVKOK1BvjrfwvXGkVcUtr4ZmjcsevTmNzriyMtOZFKg
s5OB90LsugumCh0VH3Ar
=aqeV
-----END PGP SIGNATURE-----