Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mkdir() Invalid Path

Tags:

php

mkdir

I'm trying to save files on my server, and as a prerequisite, create directories that don't exist.

I am running a script, dl.php, at /home/public_html/www3/scripts/dl.php:

$request['savedir'] = '/home/public_html/www3/scripts/images/logs';
if( !is_dir($request['savedir']) )
    mkdir($request['savedir']);

And I get:

Warning: mkdir(): Invalid path in /home/public_html/www3/scripts/dl.php

The "images" does exist.

like image 906
Dexter Avatar asked Dec 08 '22 23:12

Dexter


2 Answers

  1. Open the config.php on application/config folder
  2. Browse all the way down to the $config['sess_save_path'] = NULL; line.
  3. Change the NULL value to BASEPATH.'sessions'
like image 51
anil Avatar answered Dec 30 '22 01:12

anil


Please check your "images" folder owner and permissions. It requires to be write enabled to be used with "apache" user/group when it is executed in browser. The error is actually about "permissions" since it is not visible to "apache" user.

like image 22
smozgur Avatar answered Dec 30 '22 01:12

smozgur