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.
Related
Currently I am trying to run a Wordpress repo locally for development. I am not using MAMP pro even though I still have a 9 day trail. I figured since I'm going to be using the free version for now I might as well work with that. I have my Apache & MySQL server running along with the Document Root pointing to my Sites folder where my projectName repo sits. I'm still running off of the default port of Apache 8888.
After I start the servers, I open WebStart and import my DB into phpMyAdmin. Everything works perfectly fine and the copy of my db gets imported. I then make sure that my wp-config.php file has the appropriate settings to access this db. I then click on My Website. This pulls up the content of the website. However, it does not pull in any of the assets(imgs/js/css). I receive the following errors in the console:
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/uploads/2016/09/logo-footer-1.png
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/themes/projectName/images/circle.png
And so the list goes on and on for pretty much every asset the project could possibly have. Now configuration is NOT my strong suit, and at this point I am at a loss of what could possibly be happening. Awhile ago I did follow a tutorial on how to setup my files so that I can access them in the web browser by simply typing the name of the project with the domain .dev, example: projectName.dev. I started having issues with this after upgrading to OS Sierra and it no longer works. Could this possibly be the reason as to why it is looking for these assets in the projectName at the .dev domain?
I apologize if this does not make sense. I am willing to provide anyone with any information on this as I need as much help as possible because I still need to level up my configuration skills. Let me know if you have questions.
The images and other assets are referenced with an absolute filepath (i.e. the URL of the server on which you first set it up). This has to be changed in all database entries. There are tutorials for this on the net, but the most simple version is to open the sql file in an editor and search & replace the general URL part in the complete database.
Be sure to keep a backup of the file - that might not work on the first try...
I am using PHPStorm 10.0.3 on Windows 7, and I have had no problems working in my project so far. But for some reason, I come into work this morning and suddenly I'm not able to create a new file in any of my directories in my project? This is the error that's occurring:
The error appears 2 more times after I click OK.
I am still able to go into Windows Explorer and create the file manually, so that will tide me over until this problem is resolved.
Thank you all in advance for helping me with such a silly problem.
UPDATE:
It seems PHPStorm thinks the project is "read-only" because when I try and create a new file in the root of the project, I get the error "Cannot modify a read-only directory" followed by the path. I tried using the attrib windows command to remove all read-only attributes but it still hasn't worked.
I'm not sure what fixed the problem, but I tried two things and I thought both of them didn't work. I'll explain exactly what I did for reference to fix this problem.
Firstly, I should announce that I (used to) use Google Drive for all my projects for automated backups. I think that may have messed with the permissions, so I took all my projects out of Google Drive and stopped the process. Didn't fix.
So, I did a combination of the following:
Right-click on the folder, go Properties, and uncheck the Read-only box and make sure it affected subfolders and files too.
Change the permissions on the entire folder so that I was owner, and that "Everyone" had full access to it.
After both didn't seem to work, I tried making a file in the root directory and noticed something about it being read-only. I found out about Windows' "attrib" command, so I performed "attrib -r -s /S /D project-folder-name" whilst in the parent folder of my directory. This also didn't seem to work.
It was at this point I wanted to know if my other projects in the same directory were affected. I closed the problem project, opened another project and tried making a file anywhere. It worked. I tried this for them all. They all worked. So, I went back to the problem directory... and it worked.
I think after making all those changes, I hadn't actually restarted PHPStorm or changed project. I recommend, when trying each of my steps above, restart PHPStorm completely or at least change project to make sure the problem project is closed so you can properly test if the step worked.
I hope this helps someone in the future.
On Windows check if the working directory you are trying to save your code to is added to Ransomware protection. That might be what blocks your IDE from saving files in that specific directory.
You find Ransomware protection by searching for Windows Security. In Windows Security choose Virus & Threat Protection then choose Manage Ransomware Protection and click on Protected folders. If the folder is present try removing it from the list of protected folders.
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.
I'm trying to test a php app I'm working on in my Netbeans environment, and so I'm setting it up to run on a local Apache server. It seems to work fine when I manually copy my project into the htdocs folder, but when I try to configure Netbeans to automatically copy the sources, It tells me "Target folder cannot be created". I've tried changing the folder from read-only, including everything mentioned here but it doesn't seem to stick (Probably relevant to mention that I'm on Windows 7)
I could just keep manually copying it every time I want to test it, but that would be a major headache. Any ideas?
As I had guessed, it was a Windows permissions issue. After doing pretty much the same thing over and over without the change sticking, it finally stuck, and I was able to get things working the way I wanted. Sigh...
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.