I've been using notepad++ for web development (currently html, css, and some php and mysql). I decided to dive into an IDE to see if I could cut down on development time and have more power than notepad++.
I grabbed Aptana yesterday and, after harassing it for a few hours, have finally gotten everything up and running. The only problem is that my web pages, which are .php's, do not execute any of their included php code in the browser.
as an example:
<?php
echo "IT WORKS WOOO";
?>
ought to print IT WORKS WOOO smack in the middle of my blank test page, and yet it does not. I checked to see if I had somehow forgotten how to do an echo statement and ran it on my desktop, using notepad++, and it worked just fine.
I have the php plugin, have used the php perspective to write it and have launched it as a php web page, but nothing makes it execute the php within.
Any ideas?
-Sqm
From the sounds of it your using plug-ins to parse php files, which Aptana doesn't. You will need to install a php stack to test your scripts properly.
Try Zend Server community edition, which a full lamp stack.
Related
Good Evening Everyone,
I've been learning PHP and I'm using the built in server to learn the syntax and running simple scripts and web pages. I've been going at it for a better part of 3 weeks now but suddenly this evening. When I try to load my php webpage(s) it would load one page (or hang) then when I'd go to another page I wrote it would either hang or not load at all (Chrome is continuously "waiting on host"). I've been running Windows Server 2016 64 bit (very clean box here). I haven't had any problems with playing with the built in server until today. We are talking about very SIMPLE hello, world scrips with a couple of html tags here or there. I'm using version 7.2.0 64 bit Development Server. I ever tried x86 for giggles and it demonstrates the same behavior.
my command: php -S localhost:8000 (or any open port) I even used my IP to no avail. Suddenly my development sever just stopped working. I've made no changes to my PC.
I'm not receiving any errors or anything when I try to load my pages. What gives? I've made no changes to the ini file. I can attach if needed. Thank You guys so much!
I figured it out there was a command I was running within one of my php scripts that was causing it to hang! It's working now.
I'm trying to update a site that's using php. I built the site and tested it on this machine. But today, the Php won't run on my local machine.
To test, I went back to the most basic php page I have:
<?php
phpinfo();
?>
When I navigate to this file, in Firefox (28), the result is a blank page. (The page source shows just my code.) In IE 11, I'm asking whether I want to open or save the file.
Searching for my original problem (which was that my php code was showing up rather than running), it was suggested that php wasn't installed. I don't know how it would have gotten uninstalled, but I went ahead and installed it again (from http://www.microsoft.com/web/platform/phponwindows.aspx) and still no joy.
Windows 7 SP1
Updates in response to suggestions:
Pardon the beginning stuff, but I'm not primarily a web developer. (I do databases.) This is stuff I'm doing for an organization I'm involved in. I don't actually remember having installed/configured a web server in the first place, nor do I remember having installed php before yesterday (though maybe my son did that for me).
After seeing the replies here, I followed the instructions on this page: http://webmasterjuice.com/how-to-activate-built-in-web-server-windows, but I'm still seeing the same thing.
Update:
I've confirmed that IIS is running and the php was installed. I've followed instructions I found online for getting php working in Windows 7 with IIS. However, it still doesn't make sense to me to have to do this. I'm sure I didn't do any of this when I started working with php. I'm not trying to use my computer as a web server. No interest in working through localhost.
I'm creating the file in a simple web-oriented editor (Crimson Editor). Until recently, I could use the editor's preview function on a file, whether HTML or PHP, and it would run correctly. I'm baffled as to why this stopped working.
A few things to look for:
It's php running besides been installed? (obvious, but maybe it got killed by some reason)
Have you included the phpinfo() call inside a html document?
Obviously you named the file with a .php extension and saved it within the document root of the server..?
I got the PHPagination script, from the official website, but I don't know how to integrate it.
I tried to copy the source of the demo.php file, from that website, which can be found by clicking on "Interactive Demo":
http://phpfiddle.org/main/code/msb-v13
and then add the code from "Get Code", which is the following:
http://phpfiddle.org/main/code/jau-435
But when I paste the php code into the demo.php page on my local computer,the PHP script is shown in plain text.
I tried to put the PHP code in the beggining of the code and at the end of it, none of the following options worked.
I am newbie to PHP, I used to know just HTML and CSS and don't know how to integrate this code, I need it as soon as possible and don't have time to learn PHP.
Thanks alot! :)
Always run PHP code between <?php and ?> tags. Otherwise it's not counted as PHP and will not render. You might need a server for that to work tough, in which I case I recommend WAMP (for Windows), LAMP (for Linux) and MAMP (for OS X).
http://www.apachefriends.org/en/xampp.html
PHP won't run locally the way HTML will, at the very least you're going to have to install something like XAMPP and learn how to use it to set up a local server. Either that or do your testing on your live server.
I've got around 14 IDE's installed for testing on my WinXP box right now, from Notepad++ to Netbeans, Aptana to Zend Studio. I'm trying to find one that will do what I need, but no luck finding a solution yet.
My goal is this:
The IDE is open and I'm working on a
PHP file. Click a button or hit a
hotkey...
My IDE sends the file I'm working on
to an external app (Firefox, Lynx,
Chrome, etc.) with any command-line
parameters I specify, processes it,
then returns the output (HTML source,
in this case) back to my IDE in an
output window and/or new file tab.
Seems like a simple request, right? ;)
For clarity, I'm not interested in downloading Win PHP binaries and simply running the script inside my IDE. I've got a virtual server setup (Virtualbox) which perfectly mirrors my live server and really want to use that for generating output and testing. Also, I'm trying to avoid switching back and forth between IDE and browser to check the source.
The Zeus editor can run external applications via it's tool setup and capture the application output to a tool output window.
To add the name of the current file to the tool command line just use the $fn macro tag as a marker when setting up the tool command line.
You can try with External Tasks in any Eclipse-based IDE. Of course, it won't read your mind, so its up to you to configure the task:
http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.user/tasks/tasks-exttools-running.htm
Also, Zend Studio has support for Virtual Machines, though Im not sure if it's relevant to your question.
Gvim, what else? Use a command like this:
:r ! [some command]
And the output from [some command] will be pasted into your current file. Or:
:20,25 ! rot13
Will take lines 20-25, run them through the external rot13 command and put the output in it's place.
Do I need a special library to run PHP on Windows environment Vista?
I can write simple message like echo "hello" but whenever I try to run any these scripts no error nothing display on the page http://php.net/manual/en/function.crypt.php.
I'm new to PHP please help
When in doubt...
<?php echo phpinfo(); ?>
If that code outputs information regarding your PHP version and settings, PHP is installed correctly.
There would be errors in your code if nothing is displaying. Post the code you are having trouble with and we can help you out.
Have you actually set up a local server? You'll need this to run PHP scripts. For a newbie I'd recommend WampServer since it's really easy and handles all the complexity of installing a server. Once installed and running, try http://localhost/ in your web browser.
Based on your comment though, I think the problem is that the sample code on the page you posted won't work on their own, you'd need to combine them with other things. For example the first one references a variable $user_input which you'd replace with a variable taken from user input (eg a form) on your site.
I suggest finding some tutorials online (or buy a book) and walk through various proper examples to familiarise yourself with PHP.
Do you have PHP / Apache installed at the moment? If you don't, try XAMPP. It comes with an easy and convenient installer.
Like most languages your computer must have the language/compiler installed in order develop and run scripts/applications. PHP was originally designed for web development so you won't usually find it installed on PCs by default.
The easiest way to develop PHP is to upload the scripts to a web server that has PHP installed and then test in your browser in the same fashion that you'd test an HTML page.
Otherwise to do it locally on your computer you can install a web development environment which acts like a web server. Essentially eliminating the upload step.
I believe the most popular for Windows is Wamp Server