The result of the code above produces all files in the directory like the quote below.
But it doesn’t produces any directory although it has directory1 named “dir1” and directory2 “dir2” in the same directory.
Can I make my target result below with your help?
The code above works fine. but as I add error_reporting like the below.
it says something wrong when I open the target.php with sudo nano after it downloaded in the client.
I have some projects in my old server PHP5.
I am on the way of immigrations of them to a new server PHP7.
When I do work, I am more convenient in the old server at the moment…
So I do work in the old server for new server, and moving it to a new server.
AS possible as I can, I make the code compatible both PHP5 and PHP7.
Rarely I can use the code below.
if (PHP_VERSION > '5.4') {
} else {
}
I can move the files with a USB.
but
Now I think that downloading the projects to the new server is going to be a good way.
That is why I made this post “Downloading a directory”.
The proverb “Necessity is the mother of invention” comes up to my think just ago.
When I finish the immigrations, I will do work in the new server PHP7.
And the old-server will be depreciated.
The output buffer clears memory. Following PHP statements are bundled together and can be output all together rather than one at a time. Try remming ob_clean(); and see if the error messages change.
Also try inserting echo __line__; die; to try and pinpoint the errors if specific line numbers are not shown.
Can you expand on exactly what you mean by new and old servers.
Do you mean two different computers both running localhost or are they online?
Have you access to a remote online server? If not there are free remote servers available.
AS possible as I can, I make the code compatible both PHP5 and PHP7.
Some PHP 7 code will produce errors when used on PHP 5. Just leave the old scripts, copy to the new PHP 7 server, set maximum error reporting and try to fix the new script using PHP 7 latest features.
This means error line is 20 “ob_clean();”.
Thanks for teaching me how to pinpoint the error line.
You’ve done this some days ago. but now I understand your intention more clearly.
I find it is worth including error reporting because errors are instantly displayed. New error messages can take time to resolve and once resolved are usually not repeated.
Without error reporting it is like programming with blinkers, not seeing all that is happening and only seeing a restricted view which could crash at anytime.