How to fix the blank line added to my downloaded files? - download

I'm using an upgraded version of phpwiki. Before, it was running on Centos 6 with Apache 2.2, Php 5.3 and Mysql 5.1. Now it works on Centos 7 with Apache 2.4, Php 5.6 and Mariadb 10.3.
But there is still one issue : when I download a previously uploaded file that is stored on the server, this file is exactly the same, but with a blank line at the beginning.
First, I verified if the file is stored or not with this blank line to understand if the problem was related to either the download or the upload.
There is no space at the beginning so the issue is apparently when I download it.
As well, I observed that the download is managed by providing the direct URL of the file thanks to an statement :
file.txt
In facts, the filename is stored in the database with a field that describe the path on the server (in the previous example, "file.txt" and "wiki/uploads/101/file.txt")
So I'm wondering if the problem is not in the configuration of Apache or Php.
Thanks for your help.

I found the solution.
At the end of a php file, there was a blank line after the "?>" statement.
Removing it solved my problem.
My thought process was removing all blank lines after this statement recursively in my website www folder. After seeing that this solved my problem, I reverted my changes and tried subfolder by subfolder to do the same thing to find easily the concerned file. And I repeated the same process file by file to find the concerned file.

Related

Problem with the config file of ElasticSearch

I am trying to install Elasticsearch on my computer. I am following this tutorial for the purpose. The steps mentioned in this tutorial works fine in one computer. But when I am trying to install ElasticSearch in another computer, I found that the config file is entirely commented unlike the config file of the previous computer in which I could install the Elastic search. I have tried downloading elasticsearch multiple times, but every time I found that the config file is commented. I have also tried manually pasting the config file in the second system, but that attempt fails as well. Is there any issue with my system that prevents the config file from getting downloaded in the right manner? Also what should be done in my case. Any help in this regard will be of great value.

Strange forward slash in 'clean' Laravel project

I was developing as usual on my Laravel project tweaking with the Queue driver settings in my .env file, when all of a sudden a random forward slash appeared at the top of my project which caused some random issues. I've cleared all cache's, routes, views etc but I am still getting the strange forward slash. I even get it in the console when I run a command.
Every page:
I assume its some kind of strange bug in Laravel. Hopefully someone can tell me whats the issue. Thanks in advance.
check you files in the config folder: app.php, database.php, ... and also public/index.php and look for a \ before the <?php or if you closed it somewhere.
if you find nothing, lookout for an echo in those files. (on windows use grepwin for fast search)

localhost on mavericks accepts one file, denies an adjusted version of same

Recently set up localhost web Apache2 web server on my mac running mavericks for testing. Everything went smoothly (site up and running, page rendering correctly) until I added a revised version of the html file to the site. The original file runs fine (some D3 data visualization code) but the revised file results in a "permission denied" error. I'd post the full code for both files, but prob too long and person helping with dev is convinced it's not an issue with the file, but one with my sys config. Guidance most appreciated.
This turned out to be a permissions issue on the updated html file. Went to file info and adjusted permissions to match the original html file and it worked.

Second Laravel installation redirecting to the previous Laravel installation and blank page issue

Steps that created the issue:
Previous Laravel 4 installation exists (Status: Working Perfect!)
Installed second Laravel 4 project. After installation, I opened the project in browser, it redirects me to the previously installed Laravel index page.
Tried installing Laravel 4 the third time. Same issue. Both, the installation points to the first Laravel index page.
Tried (Steps didn't solve the problem):
chmod 755 permission to app/storage
restarted apache2 several times
Next Step I took something strange happened:
I removed the first Laravel 4 project from the server.
Now, when I open the second and third Laravel projects. Both, the installation gives me a white blank page/screen. No error, nothing.
I set debug to true, still nothing.
Then, I tried to load the page without public in the url. Instead of getting a list of folders (app, bootstrap, public and vendor) and files. I still get a blank screen.
I copied back the first working Laravel project to the server. Same problem starts, the second and third installation points to the first Laravel index page.
I am using Lubuntu 14.04 32 bit. I tried several other things, searched for solutions in google and stackoverflow for hours. Still, couldn't solve the problem. Just don't know what I am missing here. Help will be appreciated. Thanks in advance.
Sounds like you're missing a configuration for your new site in your /etc/hosts file, or a missing Virtual Host. When you hit the URL for your 2nd installation, the browser doesn't know where to go.

PHPStorm - Invalid descendent file name

I'm attempting to sync my local PHPStorm project from my Windows 7 PC with my Ubuntu server.
When I try any kind of connection (e.g. "Test SFTP connection"), it fails with
Invalid descendent file name "C:\nppdf32Log\debuglog.txt"
the folder mentioned doesn't exist on my Windows machine, and of course not on my Ubuntu server.
Even the most basic operation connecting to the Ubuntu server is failing because of this - Jetbrains support suggested asking here, so does anyone have a clue?
You have a file on your Ubuntu server with that C:\nppdf32Log\debuglog.txt name. YES -- it's on Ubuntu and YES -- it's actually a file name and not full path (Linux allows : and \ characters in file names).
Unfortunately such file name is invalid on Windows and library used for SFTP communications in PhpStorm does not allow to process such files in any way (yes, it's valid as full path but not as file name alone).
The solution is to connect to your SFTP using another program (e.g. FileZilla) and delete that file. After that you will be able to continue with PhpStorm built-in SFTP functionality.
P.S.
Such file is usually created by Firefox on Linux (google that file name for additional details).
https://askubuntu.com/questions/144408/what-is-the-file-c-nppdf32log-debuglog-txt
Jetbrains support suggested asking here
That's odd (and hard to believe for me) -- they should know about such issue for sure -- you are not first who is facing the same error.
In any case -- this is the ticket to watch after -- hopefully the used library (for SFTP communications) will allow handling such situations better in the future.
http://youtrack.jetbrains.com/issue/WI-2449
I met with the same problem,
but I included logging of errors (description here https://devnet.jetbrains.com/docs/DOC-1202)
and I saw that I had created a file with incorrect name
I had this same problem, but it was not due to Firefox and I wonder if the original asker might have made the same mistake I did in configuring his xdebug.
As a newbie, in setting the value for xdebug.remote_log in my php.ini (actually in separate xdebug.ini), I used the windows file path to my project on my local machine. Why? Because the value called "remote_log", so I mistakenly thought it wanted the path on my windows machine, which I thought was very strange at the time. But I am new to remote debugging, so... Oops.
Using windows path is wrong:
xdebug.remote_log="C:\Users\Buttle\PhpstormProjects\xdebug_log.txt"
And it results in:
/var/www/myproject/C:\Users\Buttle\PhpstormProjects\xdebug_log.txt
(the bolded part is the actual file name)
This is right:
xdebug.remote_log="xdebug_log.txt"
And presumably results in:
/var/www/myproject/xdebug_log.txt
(the bolded part is the actual file name)
It appears that Xdebug saves that log file inside of the folder where the requested php file came from (in my case, my project's index.php file).
I imagine that if I enter an valid linux path, I might be able to put the file somewhere else. E.g.
This might work:
xdebug.remote_log="/var/www/xdebug_log.txt"
So this solves 2 problems: 1.) why the heck doesn't xdebug log anything on its server (it does!) 2.) descendant file problem.

Resources