I am putting an old website up on a new server and i've noticed various issues. Firstly, if i look at any of the files locally they all have double line spacing - anywhere there is a newline there has also been a blank line inserted. This is the same in netbeans and notepad++. Then, when i SFTP the files to the server and view them in Vi i see ^M at the end of each line. The final thing is that when i'm having issues making the site actually work, i've tracked this down to a common includes.php file which when i view it has been converted to a single line of code - i can still see ^M but there isnt a single newline in there. at the bottom of vi it actually says: "includes.php" [noeol]
I'm working locally on windows, i do have a Mac aswell i could try things on. My remote server is running Ubuntu 9
Please let me know if this question would be better on serverfault
Run the files through any of a number of standard utilities and save yourself a lot of time. I think dos2unix is usually on most distributions. If not it should be in a repository somewhere.
(Yes, this probably a serverfault question IMO.)
Snaken, had the same exact thing happen to me last night. I think I chalked it up to Netbeans, because it's never manifested itself in Notepad++ in several years of use. Good news is that if you open in notepad++ and re-do the returns, the tabs will reset themselves without fail. The bad news is that this is manual. For me, it was only three files, so no biggie.
This explains how to remove the ^m from line end: http://www.tech-recipes.com/rx/150/remove-m-characters-at-end-of-lines-in-vi/
Related
I just fixed a problem but do not exactly understand why the solution works.
Setting:
Windows 10
Laravel 7.0
PHP built in server (via php artisan serve --port=80)
Hosts file with entry 127.0.0.1 something.local
Problem:
Making a web page request to http://something.local in the browser took very long to load. Upon inspection in chrome dev tools I found out that it is not the server but the actual content download.
Although we are talking about ~7MB to download a download time of >10sec seemed insane to me.
Solution that I do not really understand :
Changing the hosts file entry to 127.0.0.1 something.habibi fixed it for me.
Why does it take so long to download a web page if I use an entry ending in .local in my hosts file?
Thoughts:
.local is not a top level domain but a special-use domain. It seems to me that because of this the request to a url ending in .local might not stay on my machine but goes through my wlan/router somehow and thus takes longer.
But this is as far as I got. It would be nice if someone can make better sense of this behaviour.
Unfortunately I can not make the special behavior of a special-use domain any clearer to you as this is not my forte at all.
But:
Do you - by any chance - have a chrome extension called "Xdebug helper" installed?
If this chrome extension would be the actual cause of your problem than your solution makes sense: changing the url in the browser has the effect that the Xdebug helper extension does not debug this new url you just put in.
Therefore you might think that your problem is caused by the different ending (switching from ".local" to ".habibi") but in reality it is just this chrome extension that gets disabled for the new url.
So long story short: your question is not reproducible and thus can't really be answered.
By the way: Others seem to have the same problem.
I searched far and wide and I'm not even sure it is possible, but please let me know if you know anything that might be useful.
I use PhpStorm 9.0 to edit my .php files. I sometimes use multiple servers and multiple local computers to work on one project, which calls for a lot of synchronizing of files.
PhpStorm's built-in synchronization function works pretty well, however I repeatedly face the problem with line separators.
For example out of 50 files there are 3 which are changed, but since the server changes line separators on it's own, PhpStorm treats all those files as changed, which means I can't review just the 3 files, I have to browse through all 50 to check which are changed.
Anybody here has been successful with changing this behavior to ignore line separators?
Well .. technically line endings are kind of ignored (when comparing content by lines) .. but files with the difference in line endings only are still listed as being different in the actual file list:
https://youtrack.jetbrains.com/issue/IDEA-101502
https://youtrack.jetbrains.com/issue/IDEA-139732
Watch those tickets (star/vote/comment) to get notified on any progress.
I have a strange problem about an additional line above my PHP output.
I'm using the Smarty template engine for formatting my output on a webpage. After I programmed a API connection, I get a newline above the output of the added subpage. Of course, I googled this problem. What I've tried so far:
deleting all newlines at the end of all files and saving them again as UTF-8 without BOM
auto_prepend_file in php.ini is set to nothing
deleting the Smarty cache, turn caching off
One other strange thing is that if I test the program on my local PC (using XAMPP), I get the newline on every page. But when I test the system on my customers live server, only the affected API-page gets this newline. PHP warnings (E_ALL) appear above the newline.
Anyone got a idea that I haven't tried yet?
Anyone got a idea that I haven't tried yet?
Well, as we cannot see the code, and while this is not an ideal or robust testing scenario, in your case this might be useful.
In the files where you think the error may be, starting with the first file which runs, add something like exit('Here');.
Then run the code and see if the new line is there before the exit message, if not the issue is after that exit().
Delete the exit() from that file (make sure you do this!), then add it to the next file in the run order.
Run the code again, if no issue, repeat through the files in load order until the issue presents itself.
When the issue is present, you know the issue is between the code/file from the last time you exited and the current exit.
Examine that code carefully, the issue will be there.
Again, this is a little tacky and not a great test or debug method, but it can be helpful and sometimes necessary without a testing environment in place.
Also adding, as #Fred-ii- suggested, removing the ?> tags at the end of PHP files can help, if you have them (in fact you shouldn't have them there, this used to be a requirement many moons ago but generally just causes issues/headaches).
I edited a bunch of PHP files (with N++) on Computer A, uploaded it to a server, downloaded it to computer B (with N++), and they lost all their line breaks. I've done this routine many times and never had this problem.
I've tried
EOL Conversion
Opening in different text editors
Search/replaces
Everything I found on Google/SO
Open up the file in Notepad++, choose Edit -> EOL Conversion -> Windows. I kept having this problem and somehow it had been set to Mac. Transferring in binary mode worked, but it was a hack. This is better.
There seems to be a question missing?
If you want to format it, you might just want to let a code-editor that knows indentation (auto-formatting) fix it for you. Eclipse can, I'm sure netbeans can too.
I think eclipse auto-formats everything you paste automagically, but otherwise just find the formatting commands ;)
I am new to joomla and I need to work on a joomla website for a school project. I modified an existing module to make it display featured projects and it does that flawlessly when I test the site locally. However, when I uploaded my files to the hosted copy of the website, the module will load but does not display anything. It just loads the title and the area for the php output but there is nothing returned by the script. Why would this be happening? I have joomla mostly figured out but I'm stumped when it comes to this problem.
As far as I can tell, all files related to this module have been copied over successfully and it is setup properly in the module manager. I turned on debugging mode on the hosted copy and got this message when trying to load another page with this module on it:
Parse error: syntax error, unexpected
T_STRING in
/home/content/s/r/s/srsgdmnet/html/components/com_rbids/rbids.html.php
on line 1
I looked at the file and I don't have a clue what it's talking about. Line one is just "<?php" which is fine. Is it just saying line 1 but actually referring to a problem elsewhere? This file is part of a reverse auctions component that my module interacts with. I didn't modify the code in that file with the exception of using a regular expression (search using "\n\s*(\n)", replace with "\n") to remove excessive amounts of whitespace via the replace command in Netbeans. This cut roughly 3200 lines from the file, making it much easier to navigate. I assume this did not alter anything in terms of code because it still works fine when used locally.
I modified my local configuration.php file to use the same database as the hosted copy to see if it was a database issue but it still worked fine so that rules that out. The php.ini files are the same on both copies with the exception of the local one having the Zend stuff commented out so I could use Xdebug (made this change after the problem occurred in an attempt to locate it). I have stepped through the code with Xdebug and haven't been able to track the issue down so I'm thinking it's a configuration problem.
My local copy also does not load certain modules (main menu, for one) and I can't navigate to some of the other pages, not sure if that is related. The code is the same for both copies yet each one has different results. Am I skipping vital steps for migrating the code?
I am using Joomla version 1.5.9. Please help!
Your question is ten days old, so perhaps you solved it already. But my suggestion would be to check the code for forward and back slashes. It might be that the code uses \ which works locally but fails on your server where it needs /. In Joomla extensions you can replace folder separations by DS, in the way of 'folder'.DS.'subfolder' instead of 'folder/subfolder'. The API will replace the DS by \ or / as appropriate.
However, the parse error you get indicates that something is missing in the syntax of your code. You will just have to go over it with a magnifyer glass. Sometimes when the error refers to the first line the impact of something missing works its way back to the beginning of the file. It could be a ' or ; or something small like that.
Regardless of your module, you should update to Joomla version 1.5.15 which at present is the latest version. you are 6 security releases behind schedule!
The group I have been working with has come to the conclusion that somehow Netbeans is messing up some of the files when we edit and save them. We tested by taking files from our server, opening and then saving in Netbeans, and then uploading back to the server. Sometimes this produced files that apparently did not have any newlines in them and led to php errors, breaking components or even taking down the whole site.
Our current workaround for this is to just take the files this happens to and use notepad++ to make our changes before uploading. It's a very strange issue and caused us a lot of grief. Hopefully the Netbeans team fixes this in future releases.
Thank you all for your attempts to help me solve this problem.
Try closing your <?php the traditional way and see if it works or the error line changes.
I remember seeing a similar question either on Joomla or Fabrik forums but cannot remember precise answer