Using gulp livereload with XAMPP - php

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.

Related

How to access php project from localhost (Apache)

I know this question may first appear to be a duplicate of others, but I'm asking this because I have WordPress installed in my /var/www/html directory. I was learning WordPress a couple of years ago before creating a website and never used it again.
Well, I'm creating a php project using PhpStorm and testing in my browser. I'm following a tutorial so I can configure my databse (phpmyadmin), and the instructor keeps going to his localhost, which displays the directory structure as seen here:
Since I have WordPress on my localhost, navigating to that takes me to my WordPress installation, which is not what I want to access.
I would rather ask this question on here before I potentially break my Apache configuration, so how can I access this project? Do I need to remove WordPress completely? It would be nice to keep it for future testing since I'm slowly getting into making plugins.
What are your suggestions? I can't really say much as far as "what have you tried?" since I don't know where to begin.
Running in Chrome within my PhpStorm IDE takes me to localhost:63342/projectName/respectivePhpFileName.php, but I can't access it outside of the IDE yet.
Any help would be appreciated.
Just move your Wordpress outside your htdocs folder...I think he is using something like XAMPP so in that way is very easy to do it, because the folder without an index will be detected as a directory not a Wordpress URL (correct me if I'm wrong). So if that doesn't works, just go to your htdocs (/var/www/html or opt/lampp/htdocs in Linux) directory (or where your wordpress is stored) and move it to other folder (like My documents) where you can backup it, and that's it, you can create that folder and keep following that tutorial.

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.

cant run php files in a folder on windows 7 webserver which was previously created on xp webserver?

im doing a php project. all is fine doing it in xp webserver which im using iis..but now i have set up a new pc with windows 7 and iis.
problem is when i copy my php files which is in a folder(e.g portal1) from the xp wwwroot to the windows 7 wwwroot, i cant access it on the browser. it returns an internal server error.
now i assumed i didnt properly set up my web server or even php. i have done it a dozen times following tutorials and im pretty sure its all correct.
i have done a further research on the folder itself and has led me to a theory that this has to do with permissions.
when i copy directly the whole thing,it wont run, BUT if i CREATE a folder and the subfolder with all the same names as the one i copied and just take the php files and put it accordingly, it runs ok!!
now that has something to do with inherited permission i think. how do i overcome this?
i dont want to everytime take the updated work folder from my partner which is done in xp and i have to create new folder and its subfolder with all the same name on my machine and then copy the php files accordingly. thats a lot of work!!
i just want to copy the folder and put it in my wwwroot folder and run it on the browser without problems. how do i overcome this permission issue?
any ideas?
By the sounds of things, you're working on a project with someone else. Copying & pasting is the absolute worst way of sharing files when working on a project with multiple people. You should really be using versioning like git. That's pretty hard to set up and learn though. An easy solution which will work for the time being (but won't manage conflicts well) is to use Dropbox. Set up a free Dropbox account, and create a folder in that called www or whatever you want. Then install WAMP (way better than IIS), and create an alias to the www folder in your Dropbox. Do this on both machines. Now every time your partner makes a change, it will be instantly reflected on your machine, and vice versa. Easy, free, and will work while you learn a versioning tool.
I know this doesn't address your actual problem, but it should be more helpful to you.

Do i have to tell IIS where my pdt PHP project is or should Eclipse/PDT have done it?

I've been reading through the docs and testing out what i can.
I've installed PHP, Eclipse + PDT, IIS settings etc. - I'm reasonably sure they are all set and should work.
Now I create a PHP Project, add a newfile.php, basic code like :
<?php
echo "hello";
Now I right click the file,Run as -> Web Page and i get a 404.
Eclipse has tried to launch http://localhost:80/Php1/newfile.php
IIS has no virtual or physical directory so the request fails.
Should Eclipse/PDT have done this mapping? Or do I need to? or should I create my projects under c:\inetpub\wwwroot
Eclipse / PDT does not configure your webserver for you. It looks like it's assuming that your document root is your workspace, so you could put all your projects in your wwwroot if you wanted to. You don't need to use the Run As dialog though, as long as the files are somehow visible to IIS.
Personally I like to either make a vhost per project, or use symlinks to bring the project directories into the wwwroot.

How to make an php project accessibile within svn repo?

Hey I've a svn repository with some php files and I want to run it over the browser. Just like a normal page. But if I go to the repo url (http://server-URL/svn) enter my username/pass, navigate to my php project and selecting the index.php it just shows me the content of the index.php but not the real rendered page.
How can I run my project?
Presumably you're using something like mod-svn in Apache to deal with your SVN repository.
If you want to run the PHP then you'll need to set up another virtualroot on Apache that isn't using mod-svn and give it a root directory which matches the location of the PHP files.
Basically, you can't manage the repository and parse the files from the same URL.
That's what I'd expect viewing the project contents through the svn interface. What you want is to actually upload the php project to a php-enabled website/host.
SVN is just a repository. You would want to "check out" the code to your local machine and have a PHP Web Server setup.
Of course, you could host it in a real website also.

Categories