httpd: unrecognized service

I've installed the Apache web server on Kali Linux and I'm able to start/stop it with:

/usr/usr/local/apache2/bin/apachectl restart[start/stop]

But if I try to launch it with service command

service httpd restart[start/stop]

it says

httpd: unrecognized service

I would use the second way to launch Apache because it's shorter and I can keep it in mind.

Probably doesn't work because I've installed Apache without using apt-get and httpd isn't in the init.d directory, but I'm not sure about this.

How can I solve this? Maybe with apt-get install httpd?

.htaccess. redirecting urls that has a "go" tag

I'm having a pretty hard time on .htaccess URL rewrites in PHP. I want to put a specific condition to it but it has not worked out yet.

I WANT TO WRITE A CONDITION TO REDIRECT EVERYTHING THAT HAS A "GO" IN ITS URL

RewriteCond %{QUERY_STRING} ^.*&go=([^?&]*)\??([^&]*)&*.*$

Redirect /alice1.html http://www.google.com' the failed condition that i tried

FOR AN EXAMPLE IF SOMEBODY TYPES

'localhost/alice1.html' IT SHOULD NOT BE REDIRECTED TO google.com

BUT IF IT IS

'localhost//alice1.html?go=www.something_something.com'

THEN IT SHOULD BE REDIRECTED.

running pyspark script on EMR

I currently automate my Apache Spark Pyspark scripts using clusters of EC2s using Sparks preconfigured ./ec2 directory. For automation and scheduling purposes, I would like to use Boto EMR module to send scripts up to the cluster.

I was able to bootstrap and install Spark on a cluster of EMRs. I am also able to launch a script on EMR by using my local machine's version of pyspark, and setting master like such:

$: MASTER=spark://<insert EMR master node of cluster here> ./bin/pyspark <myscriptname.py>

However, this requires me to run that script locally, and thus I am not able to fully leverage Boto's ability to 1) start the cluster 2) add the script steps and 3) stop the cluster. I've found examples using script-runner.sh and emr "step" commands for spark-shell (scala), but I assume there is an easier way to do this with the Python module (pyspark). Thanks so much in advance!

Error in exception handler. – Laravel

It's a Laravel-install related question. I have a public-facing Unix server setup:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/mydomain"
ServerName mydomain.org
ServerAlias www.mydomain.org
ErrorLog "/var/log/mydomain.org-error_log"
CustomLog "/var/log/mydomain.org-access_log" common
</VirtualHost>

I can serve documents fine out of /var/www/mydomain i.e. http://mydomain.org/test.php with test.php containing:

<?php echo 'test';

works fine.

In bash, with Laravel installed through Composer and looking at the files:

# ls /var/www/mydomain/my-laravel-project

.gitattributes  CONTRIBUTING.md artisan         composer.json   phpunit.xml readme.md       vendor
.gitignore      app             bootstrap       composer.lock   public          server.php

So when I browse to:

http://mydomain.org/my-laravel-project/public/

why does my application report:

Error in exception handler. 

in the browser - on a blank white screen? I'm expecting to see the Laravel splash screen.

Moreover, the log files don't reveal anything either.

rewriterule is not working in .htaccess file

i am using .htacess file for rewrite url. i have written rewritrule that is working. but one issue with its. That is when page is completely loaded url in browser again changes in querystring format. my code is below. please help how can i set it.

RewriteRule ^/?([0-9]+)/([A-Za-z,0-9,-]+)/?$ /mysite.com/player.php?/$1/$2 [R] 

i write this url

www.mysite.com/4/title

and its redirected into

www.mysit.com/player.php?/4/title

its working fine but when page loaded completely in browser address is again

www.mysite.com/player.php?/4/title 

not remain in this format

(www.mysit.com/4/title)

Please help Thanks.

Apache ant condition based on os

Im using cordova and the scripts from windows and mac are cordova.cmd and cordova What i want to do in my ant script is execute the right script based on the os:

Windows:

Mac:

I have tried:

<property name="CordovaCmd" value="" />

<condition property="isWindows" value="true"> 
<propertyreset name="CordovaCmd" value="cordova.cmd"/>
</condition>

<condition property="isMac" value="true">
<propertyreset name="CordovaCmd" value="cordova"/>
</condition>

But I get the error: condition doesn't support the nested "propertyreset" element.

So I know im doing something wrong. Any advice

Fatal error: Class ‘imagick’ not found

I am trying to install imagemagic php extension under WampServer 2.

  • I've downloaded and installed ImageMagick . I've chosen ImageMagick-6.8.8-10-Q16-x86-dll.exe

  • I've downloaded the php extension.

  • I've moved the dll extension I just downloaded to C:\wamp\bin\php\php5.4.16\ext\

  • I've altered php.ini (accessed it through wamp tray icon > right-click > PHP > php.ini) and added "extension=php_imagick.dll", without the quotes, to the extensions lists.

  • I restarted Apache. Not noticing the extension displayed on the PHP extensions list from the tray icon, I restarted the wampserver. ImageMagick extensions now shows enabled on the list.

However, I cannot use it. Doing a quick test returns "Fatal error: Class 'Imagick' not found". In the phpinfo() shows only that the imagemagick has been added to env variables.

when I try to test the imagick :

$im = new imagick( 'test.jpg' );
// resize by 200 width and keep the ratio
$im->thumbnailImage( 200, 0);
 // write to disk
$im->writeImage( 'test_thumbnail.jpg' );

I get the error:Fatal error: Class 'imagick' not found What am I doing wrong? I'm working with win7 32 bit, phph 5-4-16 and apache2

.htaccess only allow access and redirect to root index.php for only one directory

I'm getting some troubles with htaccess in my new php project . I couldn't find any solutions so I ask here , hope someone will help me out.

1 . What I need :

On root , urls pointing to existing files and folders are not accessible , except /Public/ and all its folders and files ( only /Public/ is allowed to access ) . Urls pointing to files and folders which are not existings will be redirected to root index.php. /Public/ is redirected to root index.php too , folders and files inside it are not ( direct access ).

2 . What I have tried and are not working :

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_URI} !^/Public
 RewriteCond %{REQUEST_FILENAME} !^index\.php$
 RewriteCond %{REQUEST_FILENAME} -f
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule . - [F,L,NC]
 RewriteBase /Public/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L,QSA]
</IfModule>
------------------------------------
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_URI} !^/Public
 RewriteRule . - [F,L,NC]
 RewriteBase /Public/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L,QSA]
</IfModule>
------------------------------------
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} -f
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule . - [F,L,NC]
 RewriteBase /Public/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L,QSA]
</IfModule>

Thank you in advance :)

getting session variable even after session destroy

I am newbie in php. I can not under stand a thing that session variable is outputting even after session_destroy() and session_unset().Here is my simple code for test

`session_start();
 SESSION['name']='sovon';
 session_destroy();
 session_unset($_SESSION['name']);
 echo $_SESSION['name'];

`

The output is 'sovon'. My question what is session_destroy() and session_unset() doing here and whats the difference between them? Oh! when I am deleting session_destroy() that variable is getting unset. why?