Create a folder using PHP code

Create a folder using PHP code


To create a folder on the server partition, use the PHP command: mkdir ();

In the example below, I will create a folder where your name will be the current system date.

<php $folder = date("Ymd");mkdir ($folder, 0755); ?>


The value "0755", will be allowed to read / write the new folder.


I remember:

For dedicated servers, you can use 777.

To host servers / cpanel, you should use the permission to 755.


Source:

http://br.php.net/manual/pt_BR/function.mkdir.php



    • Related Articles

    • PHP error level - error_reporting

      The error_reporting directive in php.ini defines the levels of errors that PHP will report, the levels of errors are:   Errors and Logging Value Constant Description Note 1 E_ERROR (integer) Fatal run-time errors. These indicate errors that can not ...
    • Setting environment manually PHP 5.6 - Windows

      Installing a Manual PHP 5.6 Environment - Windows This article will explain how to install and set-up a PHP 5.6 environment with Apache 2.4 so that it'll run Scriptcase. Follow the steps below with caution. Download the Apache 2.4 , mod_fcgid and PHP ...
    • Setting environment manually PHP 5.6 - Linux

      Installing a Manual PHP 5.6 Environment - Linux This article will explain how to install and set-up a PHP 5.6 environment with Apache 2.4 so that it'll run Scriptcase. Follow the steps below with caution. Note: This article was based on the Debian ...
    • Conexión con Firebird en Windows - PHP 7.3

      If you are using a manual installation on Windows, you will need to enable the Firebird extensions in the php.ini file. See below for how to do this. 1 - In the `php.ini` file uncomment the line for the Firebird extension php_pdo_firebird by removing ...
    • How to create a simple LDAP Database on Linux

      Creating a simple LDAP Database on Linux. Installing and configuring slapd We are going to use OpenLDAP(slapd) to build a LDAP database accessible for the security module WITHOUT simulating an Active Directory. This tutorial will create an LDAP ...