Delphi for PHP - location of source - php

I just installed Delphi for PHP to get an idea on how it works and have created a simple app with a button that puts a text into a listbox when it is clicked.
The app works if I copy all required files to my webserver and run it from there.
It also works if I save the project in the standard path:
"c:\documents and settings\username\My Documents\Delphi for PHP Projects"
But if I save the project in another directory, the ButtonClick event is not fired when the application runs from there. I've put a breakpoint in the event to see if it stops there but it doesn't.
The OnShow event of the form works as usual.
It really seems to be the path where the project is located to make it either work or not.
As I said, I have no experience with Delphi for PHP so far, it is probably just a simple solution that I don't see...

Your source should be at same driver of your Delphi 4 PHP installation, it is protection against cross site scripting.
So, if you install D4PHP under C:, your code should be under C: as well.
It is not a Delphi 4 PHP limitation, it is how the things works.

You have to deploy your project with Deployment Wizart ;)

Related

MAMP moodle project

I am working on a moodle based project, which I inherited from someone else. Having copied the files into htdocs folder and started MAMP, the files still don't show in the browser. Instead, the browser automatically initiates a download. I might be required to change the config file, however, since I do not have much experience with php and SQL I am not sure what exactly. My part of the project is to develop html and css, but need to be able to run it locally first.
What do I need to do to get the files run locally? The route I use is localhost:8888/whatever/whatever/index.php
In case someone else runs into the same problem - Apache downloads php files instead of reading them - here is what helped me.
.htaccess file may need changes if the application has changed servers.
Delete (at least rename if you don't want to remove it) config.php and run the application through the browser. It should initiate install automatically.
To run php and SQL I used MAMP.

desktop application with NW.js and php

I need to create a stand alone local window app using web front-end code and PHP.
Noticing that good old TideSDK is completely dead I tried searching around and the only viable option seems to be NW.js and his extension "baconface php-webkit" (https://github.com/baconface/php-webkit). Fact is, I cant even manage to start!
1- I download NW.js for windows and extract the files in a new desktop folder
2- I open a node.js console and execute these commands (https://www.npmjs.com/package/express)
3- I paste php-webkit files into the folder overwriting package.json
4- try to exec NW.exe and just get the message that Express is not present
any help?
Reverse your step 2, and 3. Copy the files into that folder then from there just run a npm install to get all needed dependencies.
I followed your steps except reversing, and it worked for me! Hope this helps.

Using gulp livereload with XAMPP

I been using gulp for front-end development lately and I find it very helpful.
I use XAMPP in windows for making PHP website some of which sometime include database operations.
Now, I have used gulp-livereload and gulp-connect for starting a server for front-end but then it won't process the PHP files.
All I want to do is, PHP livereload with database access. Like livereloading but via XAMPP's server(since it can process PHP).
yes, I have found a temporary solution for now.
See, it's just temporary but as long as you write PHP correct, you will get the work done. Let me tell you how I do it.
Though right off the start I want to tell you that this is not a proper way to approach this, you should use some MVC framework.
Anyway,
I have XAMPP installed under Windows 8.1 and XAMPP's htdocs is in my "C" Drive.
I then create a folder inside "htdocs" in which I put all my frontend + backend code.Basically, gulpfile.js is at the root, then there is a components folder in which all front-end sources reside. There is another folder at root called "www" inside which I put my index.php.
Then I load gulp-livereload instead of gulp-connect and I add the livereload.listen(); method and Tags in all the php files I want to reload.
Works very fine except when PHP throws an error, untill you correct that error, you have keep reloading the page manually.

PHP project with MySQL data on CD/DVD

Exist any way, how to place the PHP project with MySQL database on CD/DVD with full functionality? My client would like have his presentation on the CD and this CD he'd give his customers.
And the idea is, that these customers just put the CD into their PC and run the complet web presentation on their computer...
Is that sci-fi or exist any way to do that?
Thank you
The CD/DVD will have to have Apache/MySQL/PHP available to it - what you're looking for is a "portable webserver" to be run from the DVD. I used something called The Uniform Server some time back with pretty good success.
Well, the only solution I can see is not use a server-side language (seeing as there is no server here), but use only HTML+CSS+JavaScript to make your presentation, hard code the content with the HTML, and don't use a database.
Burn all of that on a CD (have an index.html page on the root folder) and when that is run from a browser, it should work.
Since most folks have internet access these days, I'd make an index.html file with a meta-refresh to a regular web page online. You can even make an autorun.inf that launches that file, but note that most computers have autorun functionality disabled these days.
You can checkout Server2Go. I only found it via googling so I can't speak as to how well it works, but it seems like it has everything you're looking for.
You can create an entire live Linux environment that they can boot off of a CD. Take a look at Knoppix. Their wiki has instructions for mounting the OS, customizing it, and recreating the disk image.
Another option might be to use VMWare ThinApp to virtualize your entire application bundle (MySQL Server, application server, etc.).
On your client computer set up the server, php plugin, and mysql. The server should point to the cdrom as the root directory. Then copy all the web files onto the dvd. Do not forget to create databases on the client computer.
I just tried CDsite from the SourceForge website. It came in handy for a similar requirement of mine. However, note, works only on Windows XP. The EXE file failed to run in Windows 7.

How do I run/use the Yii command line tool ?

What EXACTLY do I do to run the "Yiic Command line tool"
Open my reg CMD? double click on a certain file?
In the screen cast the tut tells you were going to need to use the Yii command line tool and then the screen instantly cuts to a command line that has some yii related text
My spidey sense is telling me that the answer to this question is going to probably be incredibly obvious and simple , but ive done a decent amount of searching and even if I figure it out I still think this question should be in the books because I know I cant be the only one whos never used a command line tool/was confused about this.
Only started using windows again recently but there should be a yiic.bat located in the framework directory of wherever you extracted yii. You will need to either append this location to your PATH variable or cd into the directory when you want to run yiic. You will also need php installed.
Hope this helps
Some links:
http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app
http://www.php.net/manual/en/install.windows.installer.msi.php
http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx
Have just had a quick go myself and seems to work, steps were:
downloaded & installed wamp http://sourceforge.net/projects/wampserver/
watched this vid http://www.youtube.com/watch?v=Rra_UKJRagA
downloaded yii http://www.yiiframework.com/download/
created a frameworks dir in wamp root as in vid and extracted yii to it
edited the yiic.bat to point to the php executable in wamp
opened CMD cd'd to the dir containing yiic.bat and typed "yiic webapp foo"
pressed return and got 'correct response from CMD'
shame the video doesn't have sound but thanks xibian for sharing :-)
If you dont like command-line tools, you can use Gii
http://www.yiiframework.com/doc/guide/1.1/en/topics.gii
Starting from version 1.1.2, Yii is equipped with a Web-based code generation tool called Gii. It supercedes the previous yiic shell generation tool which runs on command line. In this section, we will describe how to use Gii and how to extend Gii to increase our development productivity.

Categories