Making a directory a zip file

I would leave the current PHP 5 on the local bedroom server and treat them as an archived version. Do not make any changes to the PHP 5 source files or try to install the latest server and PHP version.

Create a shared Free Online Server and upload the archived files to the online server.

On your local living room Php 7 server, download the old archived PHP 5 files, modify, validate, upload, overwrite the online shared PHP 5 archived files.

Browse to the online latest PHP 7 files and use the free w3.org online HTML and CSS validation tools.

Report back on encountered problems and/or successful upgrade.

That is the correct way if the projects in the old server is fixed.
But the projects in the old server is upgrading a little by a little every days.
Make the old server stop and develop the same project of old server in the new server. I can do it because I can see the model from the old server although it takes some time.
if I failed dowloading a directory I may do follow this way.

interesting.

By the way, I found https://makitweb.com/how-to-create-and-download-a-zip-file-with-php/

I think he did succeed it while I didn’t succeed it yet.
Since I have a guest today, I may do not work on it till tommorow.

How do you think of the link above?

Stop upgrading the old PHP 5 server files, treat them as an archive, upload to server, download, modify, etc. If this is procedure is not followed then your work is doubled!

Please explain in detail why this procedure cannot be followed.

Not necessary and involves a lot of work. No comments, no platform, no software versions and could be that it “works on my computer” and not on your computer, then what will you do?

If my recommendations are followed the “make zip directory” is totally unnecessary. Filezilla can drag and drop directories.

Create a free shared online server - just do it, you will never look back :slight_smile:

On the way of re-building the project, if there is something upgraded of the model project, I should change again on the target project.

Let’s suppose I stop to upgrade the the model application.
And work on the target application by copying the model application.
I may think better code than the present code in the old application on the way of migration.
In this case I can’t wait the upgrading the code in the old server till migration is ended.

Does it make sense?

After I fail with the link above, I’ll change the way and never look back the failed way.

As mentioned by following the above reason, work is doubling, drastically slowing migration and making the final project later.

The majority of PHP 5 script should run ok using PHP 7 without error validation. Try and get the PHP 7 working then gradually introduce validation.

The above procedure should work because the newest PHP versions must be backwards compatible otherwise automatic PHP updates could make all online applications fail!

I am disappointed with the quote above.

The internet, platforms and software are rapidly evolving. I frequently try suggested solutions that fail on my computer.

Many Forum user questions ask why their script is not working.

I find that looking for an alternative solution is usually better/quicker than waiting for an answer and there are usually a lot of solutions to the same problem.

I am gradually getting better with my search queries but still have a long way to go :slight_smile:

I have created a Free Web Hosting account at infinityfree.net.
Using FTP, I can upload a directory from my old server(PHP5) and download it to my new server(PHP7) without any USB.

but I am still want to make a directory a zip file in PHP,

Do you have any good links to follow up for it?
Or
Is making a zip file in PHP impossible?

I use Ubuntu and with their file manager right click and select from the drop-down menu something like Create zip file.

Did you check the online PHP Manual for using zips? The have quite a few examples.

Edit:

Now that a shared web host is available, did you try installing FileZilla because it makes updating both files and directories very simple especially when directories are synchronized with overwrite only updated or changed files.

Yes, I did. it makes updating both files and directories very simple.

Yes, it has the menu “Create Archive”, when I do right click.
What I want is to make it in PHP.

I search with the key “how to make a zip file in php” or “How to Zip a directory in PHP?”
Google has some examples but I don’t succeed it yet.

The quote below is from https://www.geeksforgeeks.org/how-to-zip-a-directory-in-php/

Since my PHP is 5.2, I need to enable php_zip.dll inside of php.ini.
I did the following.

I am at php.ini at the moment.
I cannot find any words relate to php_zip.dll in ph.ini.

How can I enable php_zip.dll?

Try this link:

https://www.php.net/manual/en/book.zip.php

there are numerous examples and if there is not one about zipping a directory then look for an example about adding files and also look back on the example I gave about using glob (…) recursively too obtain all files in a directory.

Hi @joon1, Why dont you just FTP directly to your other server?

I do.
FTP is more convenient than using USB.
But I think zipping a directory is more convenient than FTP.

FTP

ZIP

FTP has 2 steps but it needs that I have to work sitting in front of the old server at the first step.
Although zip has 4 steps, I can do all steps at the new server.
This is why I think zipping is more convenient than using FTP.

In my experience I believe PHP.
I believe there is a way to zip a directory in PHP.
If you say that there is no way to zip a directory in PHP, I will give up it.

Is there anyway to upload a directory of the old server sitting in front of the new server?
if it is possible, it will be fantastic.
In my experience I don’t believe it is possible.

No it doesn’t. You transfer the files and your done. You can do it from either server or any other server in the entire world. You dont have to be sitting in front of either of them and there is nothing to “download” once you transfer the files.

Yeah, FTP

Please confirm the following…

I get the general idea that the PHP files are only to be used/rendered either on your bedroom server or your living room server. The free web host server is only used as an intermediary step for transferring between the two home located servers.

The way I work…

I use my web host server to render the latest version of PHP source script which has been developed and modified on my local desktop.

I am curious to know brief details about your projects.

Edit:

I mentioned in a previous post that dragging and dropping folders using FileZilla is very easy. Have you tried try this feature? The source directory need not be visible in Filezilla and can be dragged from any file viewer application to the free web host directory.

If the PHP files render web pages then I would:

  1. upload PHP 5 files from the bedroom server archived projects to the free web host server
  2. render the free web host projects which should be PHP 7
  3. dowload projects from the free web host server to living room server
  4. modify and update projects locally
  5. upload modified projects and render on the free web host server
  6. rinse and repeat steps 4 and 5

Problems can now be posted with problematic source scripts and a link to the free web host server.

Hi @John_Betong, this is just not necessary. The “problem” here is simply, transfer files from Server A to Server B. This is the exact purpose of FTP as well as Rsync. Any other methods are just adding unnecessary complexity to a simple problem. Either method can be automated, so the OP doesn’t even have to manually do anything if he doesn’t want to.

I agree about “transfer files from Server A to Server B” and also guessing about the projects usage. Awaiting confirmation from a previous post.

Perhaps they are for IOT Projects that gather local data, if so I have similar projects that benefit from storing data to a web host database and graphically render results.

Since FileZilla is an FTP, can I upload a directory which is in my old server sitting in front of my new server using FileZilla?

Did you read post# 36…

and try:

I mentioned in a previous post that dragging and dropping folders using FileZilla is very easy. Have you tried try this feature? The source directory need not be visible in Filezilla and can be dragged from any file viewer application to the free web host directory.