I'm trying to list the size of JS files on a website by adding website URL using PHP language.  But it can't read links that contain something like ../
81242
I have a directory structure like the following;     script.php      inc/include1.php   inc/include2.php      objects/object1.php   objects/object2.php      soap/soap.php   Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the directory structure like that for a specific reason. When executing script.php the include path is inc/include.php and when executing /soap/soap.php it's ../inc, absolute paths work, /mnt/webdev/[project name]/inc/include1.php... But it's an ugly solution if I ever want to move the directory to a different location.  So is there a way to use relative paths, or a way to programmatically generate the "/mnt/webdev/[project name]/"?
98065
I need to display some featured image info on post page. Among other info I need to display file size of image (featured image of post).  I tried this function inside single.php.  &lt;?php function getSize($file){    $bytes = filesize($file);    $s = array('b', 'Kb', 'Mb', 'Gb');    $e = floor(log($bytes)/log(1024));    return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e)))); } ?&gt;   and to echo that:  &lt;?php echo getSize('/wp-content/uploads/2014/06/some-file-name.jpg'); ?&gt;   It works, but I need help to make ti automatically grab featured image url, not to manually enter it in code?  For example I use this to echo featured image ("full") url:   &lt;?php  if ( has_post_thumbnail()) {    $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post-&gt;ID), 'full'); echo $thumb_image_url[0];  } ?&gt;    Could you please help to combine it, or to provide me with another solution?
80019
I tried this:  find . -type f -size 128 -exec mv {} new_dir/  \;   Which didn't work, and it didn't give me an error. Here is an example of what the file looks like, when using stat -x  $ stat -x ./testfile | grep Size    Size: 128          FileType: Regular File
104052
I'm writing a PHP script and the script outputs a simple text file log of the operations it performs.  How would I use PHP to delete the first several lines from this file when it reaches a certain file size?  Ideally, I would like it to keep the first two lines (date/time created and blank) and start deleting from line 3 and delete X amount of lines.  I already know about the filesize() function, so I'll be using that to check the file size.  Example log text:  *** LOG FILE CREATED ON 2008-10-18 AT 03:06:29 ***  2008-10-18 @ 03:06:29  CREATED: gallery/thumbs 2008-10-18 @ 03:08:03  RENAMED: gallery/IMG_9423.JPG to gallery/IMG_9423.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/IMG_9188.JPG to gallery/IMG_9188.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/IMG_9236.JPG to gallery/IMG_9236.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/IMG_9228.JPG to gallery/IMG_9228.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/IMG_3104.JPG to gallery/IMG_3104.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/First dance02.JPG to gallery/First dance02.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/BandG02.JPG to gallery/BandG02.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/official03.JPG to gallery/official03.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/Wedding32.JPG to gallery/Wedding32.jpg 2008-10-18 @ 03:08:03  RENAMED: gallery/Gettaway car16.JPG to gallery/Gettaway car16.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/Afterparty05.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/IMG_9254.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/IMG_9175.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/official05.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/First dance01.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/Wedding29.jpg 2008-10-18 @ 03:08:04  CREATED: gallery/thumbs/men walking.jpg
61674
I've tried to install PHP and Apache2, however when I access the file, it just shows a blank page.  I've installed the packages php, apache2, php-mysql (and some others)  I've already tried pretty much everything that I could find on the Internet.  I'm sorry if I'm not providing enough info, I will give any info that I can.
100633
I have a website built on drupal with search functionality. When I search for example for "test" the link of the search is displayed like search/node/test  Is there any possibility that if I call search/node/test?json or search/node/test/json the returned page would be plain text in json format of node ids ?
102055
When working with large and/or many Javascript and CSS files, what's the best way to reduce the file sizes?
114665
When I want to execute a php file it's displayed as text in my browser.  I have a VPS at Hostinger I installed Ubuntu 18.04 with Webmin and LAMP(installed automatically).  I checked the installation see below.  apache2 - v and php -v gives me: Apache/2.4.29 and PHP 7.2.24-0ubuntu0.18.04.6  So everything seem to be installed correctly.  My default folder is /var/www/html/ I do not us short tag in my code.  I try to lunch a file called phpinfo.php with content:  &lt;?php phpinfo(); ?&gt;   And plain text appear on the page.  If the file begin with html code it's correctly rendered, even with a .php file. But the php part is not executed. e.g:  &lt;!DOCTYPE html&gt; &lt;html lang="en" dir="ltr"&gt;   &lt;head&gt;     &lt;meta charset="utf-8"&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;h1&gt;Hello&lt;/h1&gt;   &lt;/body&gt; &lt;/html&gt;  &lt;?php phpinfo(); ?&gt;   Render :  Hello  But  &lt;?php phpinfo(); ?&gt;  &lt;!DOCTYPE html&gt; &lt;html lang="en" dir="ltr"&gt;   &lt;head&gt;     &lt;meta charset="utf-8"&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;h1&gt;Hello&lt;/h1&gt;   &lt;/body&gt; &lt;/html&gt;   Render the code as plain text.
97471
How do I extract all the external links of a web page and save them to a file?  If you have any command line tools that would be great.
16373
How do I pass have a Javascript script request a PHP page and pass data to it? How do I then have the PHP script pass data back to the Javascript script?  client.js:  data = {tohex: 4919, sum: [1, 3, 5]}; // how would this script pass data to server.php and access the response?   server.php:  $tohex = ... ; // How would this be set to data.tohex? $sum = ...; // How would this be set to data.sum? // How would this be sent to client.js? array(base_convert($tohex, 16), array_sum($sum))
10344
I am totally new to Linux, servers and websites. I recently set up Apache2, Python, PHP, and MySQL for setting up a LAMP server. I am using Xubuntu 16.04 and PHP 7.0.11. I followed a guide and placed a PHP file named testing.php in it with:  &lt;?php phpinfo(); ?&gt;    It doesn't show anything on localhost/testing.php All it shows is the code itself.
76092
I need to add PHP tags surrounding a file. It's easy to append them using  find . -exec echo "?&gt;" &gt;&gt; '{}' \;   but how can I prepend the tag &lt;?php?
82255
I'm making a page which has some interaction provided by javascript. Just as an example: links which send an AJAX request to get the content of articles and then display that data in a div. Obviously in this example, I need each link to store an extra bit of information: the id of the article. The way I've been handling it in case was to put that information in the href link this:  &lt;a class="article" href="#5"&gt;   I then use jQuery to find the a.article elements and attach the appropriate event handler. (don't get too hung up on the usability or semantics here, it's just an example)  Anyway, this method works, but it  a bit, and isn't extensible at all (what happens if the click function has more than one parameter? what if some of those parameters are optional?)  The immediately obvious answer was to use attributes on the element. I mean, that's what they're for, right? (Kind of).  &lt;a articleid="5" href="link/for/non-js-users.html"&gt;   In  I asked if this method was valid, and it turns out that short of defining my own DTD (I don't), then no, it's not valid or reliable. A common response was to put the data into the class attribute (though that might have been because of my poorly-chosen example), but to me, this smells even more. Yes it's technically valid, but it's not a great solution.  Another method I'd used in the past was to actually generate some JS and insert it into the page in a &lt;script&gt; tag, creating a struct which would associate with the object.  var myData = {     link0 : {         articleId : 5,         target : '#showMessage'         // etc...     },     link1 : {         articleId : 13     } };  &lt;a href="..." id="link0"&gt;   But this can be a real pain in butt to maintain and is generally just very messy.  So, to get to the question, how do you store arbitrary pieces of information for HTML tags?
71331
I am a big fan of minifying everything whenever possible. It is a sin for me to don't do this.  However, I recently read that one of the thousands tips to boost your website rank on search engines was to:     give you content context with good class and id name in your HTML     I always change id and class names to one or two character length...  Is not that I don't believe what that guy said, but I really need some confirmation on this. For me it doesn't make sense why would that matter.   Is that point correct? (in case it is) Why?
94382
I'm trying to learn UNIX commands and I'm playing this game to learn and I'm really stuck at the moment. I'm in a server through ssh and the directory is full of random files and folders and the password for the next level is inside one of the files. I have been told that the file has the following attrbutes:   human-readable 1033 bytes non-executable   I am guessing that I should use the find command and I tried find ! -executable but that returned a load of files. The only human-readable help I can find in the manual or online is printing out the file sizes in human readable. So I'm a bit lost there?  Also I did try find ~ -size 1033b but that returned nothing. But when I tried find ~ -size -1033b it returned every file in the directory.
123687
Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via &lt;script src="..."&gt;, not pasted into the HTML itself.  Where’s the best place to put this in the HTML?  &lt;html&gt; &lt;head&gt;     &lt;!-- here? --&gt;     &lt;link rel="stylesheet" href="stylez.css" type="text/css" /&gt;     &lt;!-- here? --&gt; &lt;/head&gt; &lt;body&gt;     &lt;!-- here? --&gt;     &lt;p&gt;All the page content ...&lt;/p&gt;     &lt;!-- or here? --&gt; &lt;/body&gt; &lt;/html&gt;   Will there be any functional difference between each of the options?
116365
I mean, like php'h include...  something like   my_file_to_be_included = "include_me.asp"  -- >   for what I've seen so far, there are a couple of alternatives, but every one of them has some sort of shortcoming...  what I'm trying to figure out is how to make a flexible template system... without having to statically include the whole thing in a single file with a loooooong case statement...  here there are a couple of links            but it has some shortcomings I'd like to avoid... seems like (haven't tried yet) Server.Execute code runs in another context, so you can't use it to load a functions your are planning to use in the caller code... nasty...        I'm not sure about it (couldn't test it yet) but it seems like this one dinamycally handles the page to a SSDI component...  any idea???