Beginning details:
Windows 7 Professional 64 bit
WAMP Version: 2.5
MySQL Version: 5.6.17
PHP Version: 5.5.12
Apache Version: 2.4.9
I also have Git, Heroku Toolbelt, etc.
I'm trying to deploy a PHP inventory web app I have on my computer using Heroku.
Currently, it's installed on my PC using WAMP server. Up to this point, it was just a web app used at a country club where any computer/phone/tablet could access and adjust inventory as long as they were on the same wireless network as the server.
Right now, I'm trying to get to the point where the country club can access the app from anywhere, and figured, I could host it on Heroku.
Every tutorial I watch/read explains how to deploy a single index.php file that contains a single line of code saying something like, "Hello world!", but this app contains 8 folders and 22 PHP files, all in the "www" file of WAMP. I've tried learning the concepts of how this works (creating a single file for everything; trying to deploy the index.php I already have, etc.)
I have tried tutorials and a lot of Heroku reading and attempts, but I'm unable to move forward with anything in terms of adding user authentication or the ability to sell it to restaurants/country clubs. I've combed through every word on Heroku tutorials, and I don't run into a single error during anything I try, but at the end of it all, when I try "heroku open", it opens up a blank page.
My "www" directory contains:
- cgi-bin
- css
- dbBackup
- img
- inc
- js
- tcpdf
- tmp
Then, there are all the PHP files of the different functions of the app listed below those.
My main question here is...what is the file that gets deployed on Heroku in this situation? I don't understand how the CSS, JS, and other database-related functions are included in a single index.php file that is apparently the file that's deployed when you launch a web app like this.
Thank you!
The default page loaded when a site is accessed is typically "index.html" or "index.htm". This file would normally have the content to create the initial splash page with links to the different services you might offer. Those services are what you would use php for with the supporting data in your MySQL database. In addition to copying your base files and directories over to the Heroku server, you will also need to create the MySQL tables and then populate them with data. This is a relatively simple process using the MySQL Workbench. It may be tedious if you have lots of tables and schema, but it is relatively simple. Comment back if you need help in this area or would like to discuss further.
Heroku runs a standard web server and looks for "index.php" as your starting file by default. You should have either an "index.htm", "index.html", or "index.php" file in your current base (www) directory. If you don't then it's likely that you currently start your app by going to a URL (www.yourwebsite.com) followed by a slash and some other text, such as "/tcpdf/startup.html".
If you have one of the index. files, then that's your starting point. Copy the complete set of files and directories over to your heroku site and then test it based on the URL they have given you, which will automatically look for an 'index.php' file. You will need to back up and restore your database from your local system to the heroku server, which is relatively straightforward using the mysql workbench. You'll need to recreate the users and their schema permissions on the heroku site so that the php files can access the new database.
Related
First of all I apologize for the dumb question. I'm new with all this. I already searched an answer on Google, but I couldn't find anything comprehensible for me.
So, I managed to create my html, CSS, JavaScript files. I managed to install XAMPP, create SQL databases, access and update them with PHP from my html page.
Now I have full access to my files, since they're on my computer. But how does it work when I move them to a server?
First, what files should I move exactly? All the XAMPP folder? Just html, css, js and PHP?
Second, once uploaded the files, how can I access them, for updating, or for viewing the database? Can I still use XAMPP or after uploading the files to a server XAMPP becomes useless?
Thank you a lot.
First of all if you want to upload file to a online server. there are many tools which can allow you upload them. In my Case i use filezila.
This is how it is presented:
you will move everything located under xamp/htdocs/YOUR_PROJECT and move it on the server ( in my case under public_html folder). Html, php, css, ...
You can delete, rename or modify them within filezila at server file section as described in the picture. Right click on a file > all actions will be seen
for viewing the database check in Admin panet of your host website in my case hostinger and on Databases choose for example phpmyadmin and you will be redirected to you Database panel to view all your databases
I think this helped.
Your hosting provider presumably already has the equivalent of your XAMPP stack installed. (Unless you're starting with an unmanaged VPserver, in which case you'll have to install and configure an Apache-MySQL-PHP stack before your website will function.) Assuming a standard hosting solution, you will only need to upload the files specific to your project.
Basic steps to deploy from local to remote server:
Using an FTP client of your choice, upload your PHP, HTML, CSS, JS, image etc. files to your server's public_html folder. (Full path will be something like /home/example.com/public_html/ on a Linux server, depending on your hosting provider.)
Use a database manager (such as PHPMyAdmin) to upload the SQL file into a database you've created.
Update any absolute paths you may have used in your PHP files, reflecting the live/production server's filesystem structure.
Update your database-connecting PHP file(s) with the appropriate credentials. (They're probably different from your local server's user/password.)
You will want to ensure that your remote server's configuration supports all the functionality your code depends on (e.g. PHP modules and other configuration).
If you put a bit of thought into your code, you won't have to maintain separate local/remote files, and won't have to bother with steps 3 & 4. You can e.g. define your configuration based on a local IP address check (we're testing for both IPv4/6), as follows:
if (in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
// local config here
} else {
// remote config here
}
Then, does your local server become useless? If you don't ever intend to develop code again -- yes. Otherwise, you will probably want to develop and test your code on your local machine, and only deploy it to your live/production server when you're satisfied it's stable enough for public release. You don't want to do your R&D on the live server!
I have tried everything.
I recently tried to deploy a new Laravel application on my Ubuntu Digital Ocean droplet. I have done this many times in the past and have done nothing out of the ordinary with this project. I'm using https://gist.github.com/jamieshepherd/50419bb148a4f43e8266 this as a template nginx configuration, which I base all of my sites off. However, this time I deployed and went to my domain, I was served another client's site. The site had no images, styles, scripts etc. - but sure enough this was the wrong site. Weirdly, I could go to /images/example.jpg and get the correct file which would be in /public/images/example.jpg - but the actual routes were being served from a completely different folder.
There is absolutely no reference to the other client in my project anywhere, I feel like it has something to do with Laravel or PHP5-FPM setting some kind of root directory to the other folder.
I have gone to /public/index.php and just echo and died a message, and this works fine. When I revert the change and let the application run it again displays the other client's application. Here's a list of other things I've tried.
Temporarily renaming the other client's folder, as expected, NewSite throws a 404 error
Temporarily disabling the other client's nginx block, NewSite continues to serve the other client's site (remember, not css/images/scripts, weirdly)
Reinstalling PHP5-FPM
Printing the document_root, everything looks normal (/web/NewSite/public)
Trying to run the site off a different port
Pulled a working Laravel application from a completely different server, put it on this server, set the domain to point to this working application, serves the other client's site
Grep'd for any references to the client site in any of the project folders just to check I wasn't going insane, confirmed I'm not insane, though after all this I'm not sure anymore
Really I'm lost, I have no idea how to debug this any more.
Site trying to deploy: http://paragon.gg
Client site view that it's servring: https://swellhunter.co.uk
Client site NGINX conf: https://gist.github.com/jamieshepherd/4ff5430ddb13ed04f22c
Edit: Update: To make matters even more bizarre. I have temporarily removed swellhunter from sites-enabled, visited paragon.gg, still serves swellhunter's index. WHAT? There is absolutely no reference to the site at all now, I've even moved the paragongg folder to a completely different place to check. How on earth is it even finding the view with no reference to go on?
Seems like an issue with Laravel rather than with nginx or with your VPS.
Since you pointed out simple PHP file is pointing out rightly.
SSH to your droplet and run you laravel app using php artisan serve.
And access your droplet on port:3000
If the problem persists you can rule out server issues and can concentrate on debugging laravel app. Maybe be there is something wrong with you laravel app itself, some unwanted changes etc. Did you verify your laravel App?
Can you paste an LS -l of the directory? Have you checked to see what you have in the Laravel app/config/app.php for url ? I just took a look at paragon.gg and put https://paragon.gg it gave me a cert error but after I accepted it the site looked fine. Is that not the result you wanted?
i have developed in-house software for hotel management system using PHP/MYSQL. Our Client wants Software in .exe format and used in desktop. i use various softwares for .exe conversion but it only support php but i want's to connect with MySQL Database. Please anyone can help to create .exe conversion with MySQL Database..
Download PHP Desktop Chrome.
Copy all your code from site directory to Phpdesktopchrome/www directory.
Run Phpdesktopchrome.exe, it will execute like a browser with PHP compiler.
Download Innosetup Software for make exe file.
Install and run Innosetup and select Phpdesktop chrome files to create a EXE file in Option.
Install wampserver in client system with database import.
Enjoy.
There are many compliers available on web by which you can create EXE in PHP.
This program runs through dos and windows only... :) so this is good news for windows user
First Download zip from Here.
Now unzip it and open Command prompt and then go to its directory location.
Start -> run then type ‘cmd’
Use the “cd..” command to change directory.
Place PHP script to be compiled next to bamcompile.exe place it in same directory.
In the cmd prompt, at that directory, type:
bamcompile test.php
variations:
bamcompile -c test.php gives compression.
-e:something.dll allows a DLL to be embedded
Ready made examples are given in Zipped files which you have downloaded,just try it out.
Another application wapache is also there but i dont know much about it.
DOWNLOAD WAMP server from wampserver.com.
its very good for offline use server for desktop, then just copy and paste you script abd .sql file into it. and you are Done.
If your client using highspeed interenet then they can connect the server to online. but they need super computer for more traffic, another option is LAN.
If the program is for office use and no need to connect a lot of computer and internet then use LAN and WAMP.
------ Another possible you can use --------
Install WAMP then copy then .exe file "click start button > all program > and paste into startup folder". server will run automatic windows OS start or restart but it take 2-3 min. (green light)
go to wamp folder > www > make a folder for your program then paste your script.
open any browser then in address bar type "localhost or 127.0.0.1 (localhost IP for offline)" , scroll down and you will see "Your Projects" and under of this you will see your folder which you had create into wamp server > www folder. click on it and here you gooooo....
Now your client can do work with your script. Bookmark it and also create a shortcut into desktop for direct use.
Hope this may help you. thank you.
If you are getting any problem to do this work, then email me here - (krishnabiker#yahoo.com)
I think you should just convince your client not to use a .exe installer. It makes no sense.
You could have an installer that installs a local webserver and a local MySQL, and then opens a web browser and browses the local webserver. This would work, but it means your application runs on only one machine, and can't be used by two people.
On the other hand, you could install an application that talks to a central MySQL database, hosted on the LAN. But then why not install the entire application (webserver, MySQL etc) on the LAN, and have the clients access it across the LAN as a web application? Still no reason for a local install.
I would suggest:
See if you can persuade your client to move to an entirely web-hosted solution. Emphasize how easy updates are - from one central location, not from each machine; or
See if you client won't be happy with a .exe that installs a link to a URL (on the LAN).
VERY SHORT ANSWER: NOT POSSIBLE
Tell your client that it is a client-server application not a desktop app.
One idea is to have portable PHP/MYSQL/APACHE that can be stored in a CD or used and create an autorun fro it..
Tell your client you can do better than that, you can create a batch file for his use!
Then create a program.bat file with one line that runs the php (should be something like "php ").
:)
We need to bundle your project files in MSI ( windows installer ) along with PHP frameworks, MySQL and Apache.
Everything can be included in a single MSI file or you can keep server part in one MSI (PHP framework+Apache framework+ MySQL) and your Project file along with Yiiframework in another MSI.
I already made server part MSI in order to create one of my previous web project. In that project i had to configure Mysql DB (my.ini) and Apache configuration file (.conf). It worked fine.
For a desktop application I recommend that you change your database settings (if you can) and switch to SQLite3 DB. They are portable files and does not need a database server to run.
Use http://www.usbwebserver.com/ and from a stick or an CD/DVD you will be able to run your application. It is a portable version similar to W
I have a bizarre problem with WinCache and it's possible this isn't the best forum. I checked SuperUser but there are 0 results regarding WinCache. Support seems to be weak throughout the web but at least SO has discussed it before.
I have a live and a development site on the same server (CakePHP framework, Windows Server 2008 R2, IIS 7.5, PHP 5.3, FastCGI, WinCache 1.1). Live site is on port 80 and dev on 81. IIS has two web sites, each pointing to a different root folder in Inetpub\wwwroot. Each site is run under a different application pool.
Some time after a change to the dev site the live site started erroring. After some painful debugging I found out that the following (totally lame) chain of events occurs:
Live PHP script loads as normal following GET request
Live PHP script POSTs to itself as normal following user selection
Dev PHP script handles POST request and errors when form parameters are not as expected.
If I inspect the WinCache properties through the web interface under port 80 (live site) I see the document root is Inetpub\wwwroot\Live - as expected. However, if I review the list of cached files under the file cache tab I see some files cached twice. Mouse-over tells me that one is from Inetpub\wwwroot\Dev and the other from Inetpub\wwwroot\Live.
How is this possible? Why is IIS using one in a GET request and another in POST? I know that CakePHP chooses which files to load based on a formatted URL, but the index.php file which handles routing is within Inetpub\wwwroot\Live, so presumably could never request a file in a different doc root. It seems to me that PHP asks IIS for a file, but IIS is losing its marbles when communicating with WinCache.
So far I can't see any way to disable WinCache for one site, but even if I could I probably wouldn't trust it anymore.
Any suggestions on this vexing issue will be much appreciated.
I have no Problems.
Try this:
Use Wincache 1.2 (Beta)
Dont use "." in the AppPool Name.
(Opt.) Create a ProcessUser for each AppPool.
Look for session files called "wincache_session_*" in the our session directory.
Copy the wincache.php from "[AppDir 86]\IIS[Wincache]\wincache.php" in each webdirectory
and open it over http.
When i've worked on Drupal sites before, if there is internal access to the server, or if remote desktop access is available, i've always developed it on the machine it would be ran from when live, and just not made it public on the server.
However, what is the best thing to do if you don't have access to the server yet, for example if the client hasn't got anything in place?
I need to be able to build and test the solution on my local machine, or on my VPS which I have RDP access to, and be able to move it over with as much ease as possible to the clients server when ready.
Any tips or best practices? As far as i'm aware Drupal doesn't have any specific migration tools? I could be wrong though
I don't work with Drupal, but for Prestashop, Wordpress, Zencart, etc. I always use the same workflow:
I setup a vhost in my virtual sever, usually using a subdomain of my own domain (like customer.mydomain.com). Install the software with its DB etc. on the server. Setup FTP access.
I get a local copy of the files, which I maintain in a local git repository, pushing to github for backup purposes mainly.
I work with ZendStudio and configure a remote server and set it up to upload the files when I save them, so I can check them pretty much as if I were working locally. But the main advantage of this approach is that I can share the project with the customer as it progresses.
When I have to move to final server, at least with Wordpress, I have to search/replace the domain name, which wordpress saves on DB. But I do it locally. I download the entire DB as an SQL file through phpmyadmin, open it, searc-replace and upload it again via phpmyadmin to the permanent server.
With ZenCart and others the problem is the config file, which stores some paths. For long projects or long term customers I modify the config file to use some config details or anothers depending on the server name.
adding to the above comment...
Check the "backup and migrate" module and the "backup files" module. "Backup and migrate" is useful in any setup...
with this I was able to do a barebones drupal install and then migrate/replace the database with the one backed up from my local system... if the databases are named differently you will still need to edit the settings.php
"backup files" is useful for themes and content assets like images etc. but is essentially just a wrapper around gzip
I typically develop on my local machine and then upload to server once complete.
All you need to do is change the folder name in /sites/ and change the settings.php file to reflect the server settings/domain.
Something you should be aware of:
If you are uploading files on your local installation, the file paths will be wrong on the server and you will need to execute a one off mysql replace query.
Make sure you use relative paths in any hard coded links.