I have a page named zip.php
There is a directory named “dir” in the same directory.with the zip.php.
Ttwo files named “index.php” and “test.php” are inside the directory .
I like to make the directory “dir” and the two files inside the direcotry a zip file named zipDir.zip.
The zip.php has the code below for making the direcoty “dir” a zip file.
<?php
declare(strict_types=1);
error_reporting(-1);
ini_set('display_errors', '1');
// Enter the name of directory
$pathdir = "dir/";
// Enter the name to creating zipped directory
$zipcreated = "dirZip.zip";
// Create new zip class
$zip = new ZipArchive;
if($zip -> open($zipcreated, ZipArchive::CREATE ) === TRUE) {
// Store the path into the variable
$dir = opendir($pathdir);
while($file = readdir($dir)) {
if(is_file($pathdir.$file)) {
$zip -> addFile($pathdir.$file, $file);
}
}
$zip ->close();
}
but the result of the code above is the following.
Is this thread about solving your real problem of transferring files from your old php5 server to your php7 server that was discussed in your other thread? If so, you are going about this the hard way, but on the other hand, you are learning new things which is always a good thing.
If the important thing is to just transfer files, then FTP or networking your computers will be the easiest fastest way to get there, FTP being the easiest.
No. The operating system doesn’t really matter, but it does matter on how you installed PHP. If there’s a problem with the zip dll file not loading, then your PHP configuration is messed up whether you installed that through a 3rd party program or installed the binaries yourself.
As many have already suggested, you should be using a more recent version of PHP. If your live server is running on PHP 7, it doesn’t make sense for you to be using PHP 5 on your development device.
Unfortunately trying to transfer files from PHP 5 source to PHP 7.
As previously mentioned in another topic a PHP 5 Server located bedroom and OP wants to transfer files to a PHP 7 Server in the living room. Currently using a thumb-drive to manually transfer files.
Yeah. It still doesn’t make sense to be running PHP 5 on any server as of currently. There are plenty of ways to upgrade PHP. The main problem with doing something like this is compatibility issues. If the local server is running on PHP 5 and files get transferred to the one with PHP 7, most likely those files will break because some files may have deprecated functions. Then if the OP edits the files on the server with PHP 7 to comply with PHP 7 and transfers the files back, now it’s also going to break the local PHP 5 server as well since those files may have more up-to-date functions that may not even exist in PHP 5.
My point is, just stick to using 1 version of PHP on all machines to avoid any of this. I run PHP 7 on all of my Macs even my “remote” Mac Mini that’s supposed to emulate a live PHP server running PHP 7.
It was some years ago.
I don’t remember how I installed it.
It was one-click installation for Apache, PHP, mySQL and phpMyAdmin.
I was so happy because I installed it successfully.
After that I work with it for some years, but I completely forget how to install it and
where I downloaded the one-click program.
When I download Xubuntu, Apache, or something these days.
I write the installation process of major parts downt for installing it again.
Yeah. The combination doesn’t really make a lot of sense. What you want to do is emulate a local remote server as closely as a live server. Majority of live servers run on Linux (either centOS or Ubuntu) so it doesn’t make sense to use Windows as a primary OS for your local remote server. But nevertheless, what I would do in your situation is re-install PHP using a more recent version through the binaries. This should be able to fix your ZipArchive issue since the zip dll should be included in those files.
I can re-install it and make a new server(Xubuntu, apache, PHP, mySQL and phpMyAdmin) now becaue I have the record of installing and setting process on my note.
But I cannot re-install it on the old server(PHP5) because I am afraid that the old project in the old server might be possibly destroyed.
Does it mean that they installed one by one intsead of by one-click?
if the quote above means each installation of apache, php, mySQL,
the new server is installed through the binaries. but the old server is not installed through the binaries.