diff --git a/.htaccess b/.htaccess old mode 100644 new mode 100755 index 608100c132403667147553758dd5cae2e8e35b85..2e3e26916d1a26266d1e11ffd8ce0d26ed3ea6f4 --- a/.htaccess +++ b/.htaccess @@ -3,4 +3,7 @@ RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^ index.php [L] \ No newline at end of file +RewriteRule ^ index.php [L] + +Order allow,deny +Allow from all \ No newline at end of file diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 index 30e22626b28b17344261408f0060b345cc7a917c..d359456c13dec038447045f2092c4e406cdb777e --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ COPY ./php.ini /usr/local/etc/php/conf.d/php.ini COPY . /var/www/html/ +RUN chown www-data:www-data /var/www/html/ + RUN a2enmod rewrite && service apache2 restart #CMD ["echo","hello"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml old mode 100644 new mode 100755 index 8fc82bdc7b741e2fb26f8873c3a179c8f25c44cd..786d6e9e87577a551cf822caab1a0544654ecef3 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,7 @@ services: volumes: - .:/var/www/html/ - ./httpd.conf:/usr/local/apache2/conf/httpd.conf + - ./public/images/:/var/www/html/public/images/ ports: - "8081:80" depends_on: diff --git a/httpd.conf b/httpd.conf old mode 100644 new mode 100755 index e0741991d85a74599977f21708ede63a69dfde7c..eeb14c103bb125ba28ff2e39da9f93464e5e3edf --- a/httpd.conf +++ b/httpd.conf @@ -2,8 +2,19 @@ Listen 8081 LoadModule mpm_event_module modules/mod_mpm_event.so LoadModule authz_core_module modules/mod_authz_core.so ServerName localhost +DocumentRoot /var/www/html <Directory /var/www/html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> + +<Directory /tmp> + AllowOverride All + Require all granted +</Directory> + +<Directory /var/www/html/public/images> + AllowOverride All + Require all granted +</Directory> diff --git a/php.ini b/php.ini old mode 100644 new mode 100755 index 61e7d9f3753a4636759526404e8065344a9d45ad..81b65ccac963aeba1ed44295d03901943e9b1a04 --- a/php.ini +++ b/php.ini @@ -1,3 +1,6 @@ -error_reporting = E_ALL -display_errors = On -display_startup_errors = On +;error_reporting = E_ALL +;display_errors = On +;display_startup_errors = On + +file_uploads = On +upload_tmp_dir = /tmp \ No newline at end of file diff --git a/src/utils/FileUploader.php b/src/utils/FileUploader.php old mode 100644 new mode 100755 index 912c4e59ce817c0d732a062dde0407a11166753f..78df37f7552316ea844fa9d1e64ce24b0b01303e --- a/src/utils/FileUploader.php +++ b/src/utils/FileUploader.php @@ -5,9 +5,15 @@ function handleFileUpload($inputName, $uploadDirectory) $uploadedFile = $_FILES[$inputName]; $randomID = uniqid(); $uploadPath = PROJECT_ROOT_PATH . "/" . $uploadDirectory . $randomID . basename($uploadedFile['name']); - +// chmod($uploadPath,777); +// chmod($_FILES[$inputName]['tmp_name'],777); +// return $uploadPath; +// return $uploadedFile['tmp_name']; if (move_uploaded_file($uploadedFile['tmp_name'], $uploadPath)) { return $randomID . $uploadedFile['name']; + } else{ + $error = error_get_last(); + return $error['message']; } }