Hey. I keep getting these 2 errors with my php code.
Warning: include(1) [function.include]: failed to open stream: No such file or directory in /home/a3362820/public_html/index.php on line 5
Warning: include() [function.include]: Failed opening ‘1’ for inclusion (include_path=‘.:/usr/lib/php:/usr/local/lib/php’) in /home/a3362820/public_html/index.php on line 5
The right file is definately in the right directory.
Warning: mysql_query() [function.mysql-query]: Access denied for user ‘a3362820’@‘localhost’ (using password: NO) in /home/a3362820/public_html/index.php on line 7
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/a3362820/public_html/index.php on line 7
Also this might be obvious, but check your CASE… and check permissions/ownership… If the file is set to 640 root:root, www-data isn’t going to be able to access it.
Is that config.php in the same directory or a subdirectory of where that .php is being run?
If so, try losing the path. \ roots it, which can often be a problem.
just:
include(‘config.php’);
when it comes to pathing, avoid making things more complex than need be – part of why I advocate putting anything the user can call directly in root, and libraries/subroutines/etc in subdirectories, so everything points ‘down tree’ instead of ‘up tree’.
Notice I was questioning that… I’d have to see the config.php file, but I doubt it’s using the return mechanism.
Your opening parenthesis is in the wrong place. goes AFTER include not before it… and if you are thinking you have to wrap it to make it syntatic, that’s only if it’s in an if statement.
Or use CODE if you can’t stand the acid trip color syntax garbage that makes it HARDER to read.
Odd, You’d figure with the syntax rules the latter would be invalid – though I’d have expected the first one to ALSO be invalid. Ok, my bad.
Though I still question the use of OR after an include; but then I don’t tend to do includes that return anything as a result since that’s sloppy coding from a security point of view… since then anything can just up and call that include and anything it does is global… which is why I like functions and returns from functions instead of using the return mechanism on include. (and in the case of really important stuff like SQL login info, include a mechanism so only approved files can ask for it in the first place)