0

So I need to include a library for my code to work, the following is what gave me the error

require_once "libs\MobileDetect\Mobile_Detect.php";

On my localhost with XAMPP it included the file fine. The libs directory is in the same directory where I am requiring it, but when I uploaded it to GoDaddy Cpanel it keeps giving me this error. I checked around but nothing on the other questions was able to fix my problem.

Here is the error message I got in my error log on cpanel.

[25-Jun-2018 22:14:53 UTC] PHP Warning: require_once(libs\MobileDetect\Mobile_Detect.php): failed to open stream: No such file or directory in /home/h0934rvnurko/public_html/CMQR/redirectmobile.php on line 9

[25-Jun-2018 22:14:53 UTC] PHP Fatal error: require_once(): Failed opening required 'libs\MobileDetect\Mobile_Detect.php' (include_path='.:/opt/alt/php72/usr/share/pear') in /home/h0934rvnurko/public_html/CMQR/redirectmobile.php on line 9

M. Eriksson
  • 13,450
  • 4
  • 29
  • 40
user3628468
  • 111
  • 1
  • 7
  • 1
    Make sure that you use forward slashes / instead of backslashes \ if the server is a linux server. Or simply use PHP's [PATH_SEPARATOR constant](https://stackoverflow.com/questions/9769052/why-is-there-a-path-separator-constant). Also, make sure that all files and folders have the correct casing (in case you're developing on a case-insensitive OS). Linux is case sensitive. – M. Eriksson Jun 25 '18 at 22:35
  • 1
    Oh my god! the forward slashes worked! Thank you so much. – user3628468 Jun 25 '18 at 22:42

0 Answers0