Unable to upload new files on Yii 2.0

I just inherited an Intranet project based on the Yii2 Framework. I’m completely new to Yii and I’m trying to understand why:

we are having issues uploading files to this Yii2 intranet. Getting a "POST 504 ERROR - GATEWAY TIMEOUT

  • I’m able to select a file, process it to be uploaded, then after 30 seconds it gives me a Gateway Time Out error.

  • I looked in the files located on the FTP Server for this Intranet, and the documents I am trying to upload are actually there. So they ARE uploading, just not displaying on the front-end for me or any of our customers.

I’ve checked the app.log file and copied it below.

I really think that ‘PHP_DEFAULT_SOCKET_TIMEOUT’ => ‘20’ is the culprit.

Problem that i’m having though:

There is no php.ini file to control the php settings. I read that I can use the htaccess file to declare these php values. Is that correct?

Because I tried changing the max_execution_time (for example) via htaccess, but it wasn’t applied. Do you happen to know if I need to reset something (maybe the server) in order for the php settings i’m declaring in the htaccess to take affect?

Should i create a php.ini file?

Here is the app.log with the recent error only:

$_SERVER = [
‘PATH’ => ‘/usr/local/bin:/usr/bin:/bin’
‘DOCUMENT_ROOT’ => ‘/home/u2-rnx1df2et8w8/www/intranet_com/public_html’
‘REDIRECT_STATUS’ => ‘200’
‘HTTPS’ => ‘on’
‘UNIQUE_ID’ => ‘YMYEIrMUbI4oYTCsBaOMpQAAAAM’
‘SCRIPT_URL’ => ‘/login/password-reset’
‘SCRIPT_URI’ => intranet_com/login/password-reset’
‘PHPHANDLER’ => ‘/usr/local/php73/bin/php’
‘HTTP_X_PORT’ => ‘27038’
‘HTTP_X_REAL_IP’ => ‘80.215.78.214’
‘HTTP_X_FORWARDED_PROTO’ => ‘https’
‘HTTP_HOST’ => ‘intranet.mydomain.com
‘HTTP_X_ACCEPT_ENCODING’ => ‘gzip, deflate’
‘HTTP_CONNECTION’ => ‘close’
‘HTTP_UPGRADE_INSECURE_REQUESTS’ => ‘1’
‘HTTP_USER_AGENT’ => ‘Mozilla/5.0 (Linux; Android 10; MI MAX 3 Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.88 Mobile Safari/537.36 EdgW/1.0’
‘HTTP_ACCEPT’ => ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9’
‘HTTP_X_REQUESTED_WITH’ => ‘com.microsoft.office.outlook’
‘HTTP_SEC_FETCH_SITE’ => ‘none’
‘HTTP_SEC_FETCH_MODE’ => ‘navigate’
‘HTTP_SEC_FETCH_USER’ => ‘?1’
‘HTTP_SEC_FETCH_DEST’ => ‘document’
‘HTTP_ACCEPT_LANGUAGE’ => ‘fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7’
‘HTTP_COOKIE’ => ‘_identity-intranet=9181a0e75f79f0594ad90067eb0b6788c5cd0618903e34928affe050f61fb993a%3A2%3A%7Bi%3A0%3Bs%3A18%3A%22_identity-intranet%22%3Bi%3A1%3Bs%3A49%3A%22%5B1583%2C%22XxM_6Fi_6wfzkWcLD-XANcpAQcCK37zP%22%2C2592000%5D%22%3B%7D; _csrf=918ded25107ce6a49ec85a48d4d7e2fc902cad77f9669d5d691ddae4e0ea4b6ea%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22RuZ5MG5YGyVDSujqMP2xEPoclsTKp6Jy%22%3B%7D; mydomain-intranet=e155c1ed0ffedb2eb052d81c9968934c’
‘SERVER_SOFTWARE’ => ‘Apache’
‘SERVER_NAME’ => ‘intranet.mydomain.com
‘SERVER_ADDR’ => ‘35.208.211.164’
‘SERVER_PORT’ => ‘443’
‘REMOTE_ADDR’ => ‘80.215.78.214’
‘SERVER_ADMIN’ => ‘webmaster’
‘SCRIPT_FILENAME’ => ‘/home/u2-rnx1df2et8w8/www/intranet.mydomain.com/public_html/index.php’
‘REMOTE_PORT’ => ‘36420’
‘REDIRECT_URL’ => ‘/login/password-reset’
‘REDIRECT_QUERY_STRING’ => ‘token=DRUyKly_B-fn0ADUp9K5btQNmGm0PaEe_1621455651’
‘GATEWAY_INTERFACE’ => ‘CGI/1.1’
‘SERVER_PROTOCOL’ => ‘HTTP/1.0’
‘REQUEST_METHOD’ => ‘GET’
‘QUERY_STRING’ => ‘token=DRUyKly_B-fn0ADUp9K5btQNmGm0PaEe_1621455651’
‘REQUEST_URI’ => ‘/login/password-reset?token=DRUyKly_B-fn0ADUp9K5btQNmGm0PaEe_1621455651’
‘SCRIPT_NAME’ => ‘/index.php’
’PHP_DEFAULT_SOCKET_TIMEOUT’ => '20’
‘PHP_MAX_EXECUTION_TIME’ => ‘120’
‘PHP_MAX_INPUT_TIME’ => ‘120’
‘PHP_MEMORY_LIMIT’ => ‘768M’
‘PHP_POST_MAX_SIZE’ => ‘256M’
‘PHP_UPLOAD_MAX_FILESIZE’ => ‘256M’
‘PHP_SELF’ => ‘/index.php’
‘REQUEST_TIME_FLOAT’ => 1623589922.7012
‘REQUEST_TIME’ => 1623589922
]

We recently migrated the INTRANET’S DOMAIN to a new hosting company, so the mail SMTP is different as well. So that probably needs to be changed somewhere as well?

Like I said…brand new to the Yii Framework.

HOW CAN I RESOLVE THIS ISSUE???

There must be a php.ini file, try executing php -i and find out were it is. Also what webserver are running? Apache?

Hi Bruno. I was able to resolve this issue. We changed hosting for the project and the mail.php file needed to be updated to reflect the new hosting’s smtp. Thanks for being the only one to respond though lol. You’re a gentleman and a scholar.

1 Like