Numbers considered as constants

Viewed 43

trying to create a folder on my Siteground hosting it gives me error:

Warning: Use of undefined constant 0755 - assumed ' 0755' (this will throw an Error in a future version of PHP)

So it considers my permission number as a inexistent constant. How to fix it? Is it a PHP configuration?

My code is very simple:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$invoices_folder_src = '/home/customer/www/xxxxxxx/yyyyyyy/dummyfolder';
        
if (!mkdir($invoices_folder_src, 0755, true))
    die('Failed to create directories...');

Thanks

1 Answers

Instead of this: if (!mkdir($invoices_folder_src, 0755, true))

Try this: if (!mkdir($invoices_folder_src, '0755', true))

This way you pass the argument as a string rather than just a number.

Related