The reason why you dont manage to create dir is in here:
mkdir ("/images/", 0777);
Theres actually 2 errors in there. First one is because you are trying to create dir on servers root directory. Im quite sure that no ISP will give you that kind of permission 🙂
First check what is your document root with simple php-script:
echo $_SERVER['DOCUMENT_ROOT'];
That should give you the directory where your homepages reside eg.
/home/websites/somedomain.com/public_html
The second error is in the end of "/images/". Dont put "/" at the end, it wont work.
So if you want to create a directory ..lets say to the document root, you would put it like this:
mkdir ("/home/websites/somedomain.com/public_html/images", 0777);
// OR
mkdir ($_SERVER['DOCUMENT_ROOT']."/images", 0777);