Netbeans PHP Application from Remote Server - Issue - php

I was using Netbeans IDE 8.0.2 on Windows 8.1 to develop my PHP applications. There was no issue with it. But later on when I start using Netbeans (same version) on windows 7, Although the ftp connection was successful but it was giving error:
Error while listing files /.

After too many searches I found that by disabling features at firewall the problem is solved, All you have to do is just run a simple command in cmd.
Run cmd in administrative mode
Paste following command
netsh advfirewall set global StatefulFTP disable
Now you are almost done!
Goto Netbeans->New Project->PHP->PHP Application from remote server
Follow other instructions and you are done! (Note sometimes you will need to do that with passive mode)

Related

How do I enable PHP to run XCOPY commands on Windows Server 2019

I have a Word to PDF converter that works from Commandline so we created a middle-ware program to accept commands via Classic ASP. That worked so we then created the middle-ware program as a Windows service and all was working fine until we moved from our dev server (Windows Server 2012) to our production server (Windows Server 2019). Now that Windows service no longer works and spits out errors about not be able to find or connect to COM.
So I dropped the middle-ware Windows service and tried using PHP to run the Word to PDF converter. But that either complains about not finding a COM or just hangs.
The PDF converter dev recommended testing PHP command using XCOPY, and lo and behold the real problem enfolds... PHP does not have the rights/permissions to use XCOPY or the PDF conversion app, or our middle-ware service. An example of the PHP is...
$answer = shell_exec('xcopy /S /I /Q /Y /F "C:\IN\Word.docx" "C:\OUT\"')
echo $answer;
So there must be a difference in security between Windows Server 2012 and 2019. How to fix that and/or give PHP rights to run apps?
Yes, UAC is disabled and the permissions on the IN and OUT folders are read, write, execute for Everyone.
How do I enable PHP run XCOPY commands on Windows Server 2019?
Your code works with PHP on Windows Server 2019. If it is not working on your server try the following:
Check that the PDF install went to C:\PDF\ and and not to C:\program Files\ because a space in that folder name can be a killer for PHP which was designed yo run on Apache and not Windows.
In IIS Manager check the Handler Mappings for PHP. You may find one or two:
FastCGI
PHP_via_FastCGI
They should both point to C:\PHP\php-cgi.exe
If you still get errors, check C:\Windows\Temp\ for any FastCGI errors.

Is Xampp required for laravel?

I am new to PHP and Laravel.
I installed Laravel and Composer , created new project and it is working fine.
Now when i tried to migrate a database using this command php artisan migrate i got errors, i wonder is it something related to not installing Xampp ? i am running Mac OS
The errors i got is
1 PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=app", "root", "", [])
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
Xampp has nothing to do with Laravel itself. Xampp is a set of tools that is usually used together to deliver websites. Xampp just makes it easier (supposedly) to install those set for you. Rather than having to install and setup all yourself.
Today people tend to avoid such sets in favour for tools like Vagrant or Docker.
Laravel even provides its own Vagrant setup called Homestead.
See ie. in Laravel 5.5 docs: https://laravel.com/docs/5.5/homestead
If you don't want to use Homestead but build your own server environment there's also tools to make this easier for you.
For example there is http://www.puphpet.com for PHP + Vagrant and https://phpdocker.io/ for PHP + Docker.
Xampp is not required but a php server like apache or nginx is required also in order to use mysql you should have mysql installed you get this error
PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
because the mysql service is turned off so I think you open Xampp control Panel and you start mysql in order for it to work and this is why you have asked if Xampp is required am I right !!!
Actually to prove that Xampp has nothing to do with Laravel you can start the mysql server from command line I will give you example in windows OS.
if you have xampp installed on C:/ Driver lets say then try cd(change directory) into this path in your command line
cd c:/xampp/mysql/bin
start mysqld.exe // this will start the mysql service for you
now you can navigate to your Laravel app and try to migrate this time you won't get connection refused error and that is because you have started the Mysql server from command line.
I think this proves that Xampp has nothing to do with Laravel.
Hope this was helpful, good luck.
Mac OS comes with PHP built into it. You should be able to use php -v to see what version. Use php -S localhost:xxxx to output the local directory to a local address.
For example, to run laravel locally, open the terminal cmd+spacebar, type terminal, open it, then use change to the path where your laravel project is.
Type php -S localhost:3000 and it should give you a confirmation in the terminal. Now open a browser and go to localhost:3000 and it should show your project.

How to launch and debug php using VS Code?

I'm new to VS Code and the php world. My experience is more with heavyweight IDE such as Visual Studio. However, I have a need to setup a php environment on my dev machine and am having some trouble getting it to work properly.
My environment is a Win 10 dev machine. I am using VS Code and php ver 5.5. I have properly installed the xdebug extension and verified it is properly installed. I have also installed the php-debug extension in VS Code.
The challenge I'm having and have been unable to find any useful information through google is launching the php website from within VS Code and then being able to debug it.
A few things I have tried, but haven't worked.
I installed the iis-express extension to VS Code which allows for running any folder through iis express. https://marketplace.visualstudio.com/items?itemName=warren-buckley.iis-express
This works, but the website doesn't display properly. IIS returns an error message saying the site is not properly configured. It's apparently missing a mapping or something along those lines.
I followed this blog. http://blog.denouter.net/2015/05/run-php-from-visual-studio-code.html and am able to run the website using the built in php web server.
Installed webmatrix and let the windows platform installer correctly install and wire up iis express to work with php. The same folder works fine when running from webmatrix.
Installed the php-debug extension to VS Code. https://github.com/felixfbecker/vscode-php-debug
Here is what I think I'm missing. I believe I need to launch the website from within VS Code for the debugging to work. I can't figure out how to "launch" the php website from within VS Code. The php-debug extension from VS Code only supports launch. It doesn't support "attach" mode. I suspect this is why when I run the website outside VS Code, the debugger doesn't work. Let me be clear, the debugger is working when I hit F5, it just doesn't ever stop on any breakpoints.
To summarize: How can I launch and debug my php website from within VS Code? I'm looking for a detailed step by step guide.
Thank you
I am the author of vscode-php-debug. You do not need to "launch the website" from inside VS Code. When you start the "Listen for XDebug" configuration from the debug section, VS Code (or rather, my debug adapter) will listen on port 9000 for XDebug. You need to run a web server like Apache, IIS or nginx locally on your PC and configure it to serve PHP files - this has nothing to do with VS Code. Then simply open a web browser and navigate to localhost and XDebug will connect to the debugger, stopping on breakpoints.
The two necessary settings in php.ini are:
xdebug.mode = debug
xdebug.start_with_request = yes
(Do not forget to add the subtitle [XDebug] before the settings.

establish a connection to the server netbeans

I have a problem with the netbeans7.3.1 when ever I try to run my php program i get this error from the browser : Unable to connect
Firefox can't establish a connection to the server at localhost:8000.
my interpreter location is : /usr/bin/php5
The project configuration : PHP Built-in Web Server (running on built- in web server)
my operating system is : Ubuntu linux.
I've been having this problem for more then 6 months now, I've looked and searched everywhere but I could not find the solution for this.
Just to mention that I had another problem with the interpreter it used to ask me to locate the interpreter every time i run netbeans , but i fixed this by installing php5.

xdebug, php on remote server, netbeans

I have my 1and1 hosted web site. I've got server-side php I need to debug.
All I've found mentions running/installing xdebug when you have a local web server
with php and mysql on a local web server.
However, I'm using the remote web server hosted at 1and1 hosting.
I'm using and loving netbeans, wow great IDE.
Anyways, how (if it's even possible) can I install then use the xdebug
debugger to debug my php code running at 1and1 from within Netbeans?
I'm wondering if it is my hosting company (1and1) that has to have xdebug installed.
I'm running the latest version of Netbeans but when I press the debug button on
the toolbar I see an error message popup that says
"There is no connection from xdebug detected within 40 seconds. The reasons could be that xdebug is neither installed nor properly configured. Be sure that your php.ini file contains these entries:
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost (or hostname)
xdebug.remote_port=9000
So I searched my harddisk, and despite having installed the full Netbeans
IDE, I have no php.ini file.
So can I make xdebug work remotely, ie. can I debug my php code as it runs on the
remote 1and1 web server, using Netbeans and xdebug?
I've only been using Netbeans for 2 days and for all I know, xdebug is not even a part
of Netbeans. Reason I say that is, I can 'run' my php remotely just fine -- it executes on the remote 1and1 web server when I push 'run' inside Netbeans -- and then the client side output on my local machine is correct. But I cannot step into the code with xdebug by pressing the 'Debug' button on the Netbeans toolbar -- is it possible xdebug did not get installed correctly with Netbeans?
xdebug should be installed inside the php folder and of course the php folder is located on the server where php is installed... at your hosting provider.
I would not expect an hosting provider to install xDebug as it seems to me it would be a huge security hole.
xDebug is not part of Netbeans and it is not part of PHP by default.
Now, looking at things on a more positive viewpoint, if you are going to develop PHP, you NEED a local server. It's very unprofessional to develop code directly on the live server.
Grab a copy of xampp and install it on your computer. Grab a copy of xdebug and install it following the instructions. Restart Apache. There, now you have a testing server.
Once you have a complete set-up on your computer, copy your PHP application's folder inside the "htdoc" folder.
NOW, and only now, should you consider developing in PHP. Develop locally, on your own testing server, xdebug will work whenever you start a debugging session from inside Netbeans.
When everything works, upload your files on your hosted space.

Categories